/*! elementor - v3.25.0 - 24-11-2024 */ .elementor-testimonial-wrapper{overflow:hidden;text-align:center}.elementor-testimonial-wrapper .elementor-testimonial-content{font-size:1.3em;margin-bottom:20px}.elementor-testimonial-wrapper .elementor-testimonial-name{line-height:1.5;display:block}.elementor-testimonial-wrapper .elementor-testimonial-job{font-size:.85em;display:block}.elementor-testimonial-wrapper .elementor-testimonial-meta{width:100%;line-height:1}.elementor-testimonial-wrapper .elementor-testimonial-meta-inner{display:inline-block}.elementor-testimonial-wrapper .elementor-testimonial-meta .elementor-testimonial-details,.elementor-testimonial-wrapper .elementor-testimonial-meta .elementor-testimonial-image{display:table-cell;vertical-align:middle}.elementor-testimonial-wrapper .elementor-testimonial-meta .elementor-testimonial-image img{width:60px;height:60px;border-radius:50%;-o-object-fit:cover;object-fit:cover;max-width:none}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-aside .elementor-testimonial-image{padding-inline-end:15px}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-aside .elementor-testimonial-details{text-align:start}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-top .elementor-testimonial-details,.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-top .elementor-testimonial-image{display:block}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-top .elementor-testimonial-image{margin-bottom:20px} FTP (self.webpackChunkextendify=self.webpackChunkextendify||[]).push([[346],{1984:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var i=n(9307);const s=(0,i.forwardRef)((function({icon:e,size:t=24,...n},s){return(0,i.cloneElement)(e,{width:t,height:t,...n,ref:s})}))},2278:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})})},3708:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})})},4310:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})})},5024:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})})},7157:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z"})})},4896:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i=n(8824).Z},4461:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"})})},9454:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"})})},8824:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})})},5621:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M4 6h12V4.5H4V6Zm16 4.5H4V9h16v1.5ZM4 15h16v-1.5H4V15Zm0 4.5h16V18H4v1.5Z"})})},9696:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var i=n(444),s=n(5893);const r=(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(i.Path,{d:"M6.08 10.103h2.914L9.657 12h1.417L8.23 4H6.846L4 12h1.417l.663-1.897Zm1.463-4.137.994 2.857h-2l1.006-2.857ZM11 16H4v-1.5h7V16Zm1 0h8v-1.5h-8V16Zm-4 4H4v-1.5h4V20Zm7-1.5V20H9v-1.5h6Z"})})},8360:(e,t,n)=>{"use strict";var i=n(9196),s=n(2175),r=n(4981),o=n(5609),a=n(9818);const l=window.wp.editPost;var c=n(9307),u=n(2694),d=n(5736),h=n(8817);const m=window.wp.editor;var p=n(424);const f=({completion:e})=>{const t=(0,r.pasteHandler)({plainText:e}),n=(0,c.useRef)();return(0,i.createElement)("div",{ref:n,style:{fontSize:"clamp(1em 1em 1em)"},className:"completion relative max-h-60 overflow-y-auto break-words px-5 pt-4","data-test":"completion-input"},Array.isArray(t)?(0,i.createElement)("div",{dangerouslySetInnerHTML:{__html:(0,r.serialize)(t)}}):(0,i.createElement)("div",{dangerouslySetInnerHTML:{__html:t}}))};var g=n(8824);const v=({disabled:e,setInputText:t,setReady:n})=>{const s=[{label:(0,d.__)("A paragraph …","extendify-local"),onClickText:(0,d.__)("Write a paragraph about","extendify-local")},{label:(0,d.__)("Blog post …","extendify-local"),onClickText:(0,d.__)("Write a blog post about","extendify-local")},{label:(0,d.__)("An informative article …","extendify-local"),onClickText:(0,d.__)("Write an informative article about","extendify-local")},{label:(0,d.__)("Headline …","extendify-local"),onClickText:(0,d.__)("Write a headline for","extendify-local")},{label:(0,d.__)("List …","extendify-local"),onClickText:(0,d.__)("Write a list of","extendify-local")}];return(0,i.createElement)(o.MenuGroup,null,s.map((({label:s,onClickText:r})=>(0,i.createElement)(o.MenuItem,{key:s,onClick:()=>(t(`${r} `),void n(!1)),disabled:e,icon:g.Z,iconPosition:"left"},s))))};var y=n(1984),x=n(7157),w=n(9696),b=n(9454),E=n(5621);const S=()=>{const{getBlockInsertionPoint:e}=(0,a.useSelect)((e=>e("core/block-editor")),[]),{toggleBlockHighlight:t,showInsertionPoint:n,hideInsertionPoint:i}=(0,a.useDispatch)("core/block-editor");return{toggleHighlight:(e,{isHighlighted:n})=>{t(e[0],n)},toggleInsertionPoint:({isVisible:t})=>{if(!t)return void i();const{rootClientId:s,index:r}=e();n(s,r)}}},P=()=>{const{getSelectedBlockClientIds:e,getBlocksByClientId:t}=(0,a.useSelect)((e=>e(s.store)),[]),n=e();return{selectedText:(0,c.useCallback)((()=>t(n).map((({attributes:e})=>e.content)).join("\n\n")),[t,n])()}},T=((0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M8.79508 15.8769L4.62508 11.7069L3.20508 13.1169L8.79508 18.7069L20.7951 6.70687L19.3851 5.29688L8.79508 15.8769Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M14 17H4V19H14V17ZM20 9H4V11H20V9ZM4 15H20V13H4V15ZM4 5V7H20V5H4Z"})),(0,i.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M17.0909 9.81818L18 7.81818L20 6.90909L18 6L17.0909 4L16.1818 6L14.1818 6.90909L16.1818 7.81818L17.0909 9.81818Z",fill:"currentColor"}),(0,i.createElement)("path",{d:"M17.0909 14.1818L16.1818 16.1818L14.1818 17.0909L16.1818 18L17.0909 20L18 18L20 17.0909L18 16.1818L17.0909 14.1818Z",fill:"currentColor"}),(0,i.createElement)("path",{d:"M11.6364 10.1818L9.81818 6.18182L8 10.1818L4 12L8 13.8182L9.81818 17.8182L11.6364 13.8182L15.6364 12L11.6364 10.1818ZM10.5382 12.72L9.81818 14.3055L9.09818 12.72L7.51273 12L9.09818 11.28L9.81818 9.69455L10.5382 11.28L12.1236 12L10.5382 12.72Z",fill:"currentColor"}))),C=((0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M12 14.5C13.66 14.5 15 13.16 15 11.5V5.5C15 3.84 13.66 2.5 12 2.5C10.34 2.5 9 3.84 9 5.5V11.5C9 13.16 10.34 14.5 12 14.5Z"}),(0,i.createElement)("path",{d:"M17 11.5C17 14.26 14.76 16.5 12 16.5C9.24 16.5 7 14.26 7 11.5H5C5 15.03 7.61 17.93 11 18.42V21.5H13V18.42C16.39 17.93 19 15.03 19 11.5H17Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M2.99902 21.0025H6.74902L17.809 9.9425L14.059 6.1925L2.99902 17.2525V21.0025ZM4.99902 18.0825L14.059 9.0225L14.979 9.9425L5.91902 19.0025H4.99902V18.0825Z"}),(0,i.createElement)("path",{d:"M18.369 3.2925C17.979 2.9025 17.349 2.9025 16.959 3.2925L15.129 5.1225L18.879 8.8725L20.709 7.0425C21.099 6.6525 21.099 6.0225 20.709 5.6325L18.369 3.2925Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M4 9H20V11H4V9ZM4 13H14V15H4V13Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M19.5005 7.5L20.4405 5.44L22.5005 4.5L20.4405 3.56L19.5005 1.5L18.5605 3.56L16.5005 4.5L18.5605 5.44L19.5005 7.5Z"}),(0,i.createElement)("path",{d:"M8.00055 7.5L8.94055 5.44L11.0005 4.5L8.94055 3.56L8.00055 1.5L7.06055 3.56L5.00055 4.5L7.06055 5.44L8.00055 7.5Z"}),(0,i.createElement)("path",{d:"M19.5005 13L18.5605 15.06L16.5005 16L18.5605 16.94L19.5005 19L20.4405 16.94L22.5005 16L20.4405 15.06L19.5005 13Z"}),(0,i.createElement)("path",{d:"M17.2105 9.62L14.3805 6.79C14.1805 6.6 13.9305 6.5 13.6705 6.5C13.4105 6.5 13.1605 6.6 12.9605 6.79L1.79055 17.96C1.40055 18.35 1.40055 18.98 1.79055 19.37L4.62055 22.2C4.82055 22.4 5.07055 22.5 5.33055 22.5C5.59055 22.5 5.84055 22.4 6.04055 22.21L17.2105 11.04C17.6005 10.65 17.6005 10.01 17.2105 9.62ZM13.6705 8.92L15.0805 10.33L13.9105 11.5L12.5005 10.09L13.6705 8.92ZM5.33055 20.09L3.92055 18.68L11.0905 11.5L12.5005 12.91L5.33055 20.09Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M3.5,10.5C3.5,12.95 5.26,14.97 7.58,15.41L6.09,13.92L7.5,12.5L11.5,16.51L7.5,20.5L6.09,19.09L7.67,17.51L7.67,17.45C4.2,17.04 1.5,14.08 1.5,10.5C1.5,6.63 4.63,3.5 8.5,3.5L11.5,3.5L11.5,5.5L8.5,5.5C5.74,5.5 3.5,7.74 3.5,10.5Z"}),(0,i.createElement)("path",{d:"M22.5,10.5L22.5,3.5L13.5,3.5L13.5,10.5L22.5,10.5ZM20.5,8.5L15.5,8.5L15.5,5.5L20.5,5.5L20.5,8.5Z"}),(0,i.createElement)("rect",{x:"13.5",y:"12.5",width:"9",height:"7"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M18.6 19.5008H21V21.5008H15V15.5008H17V18.2308C18.83 16.7608 20 14.5208 20 12.0008C20 7.93078 16.94 4.56078 13 4.07078V2.05078C18.05 2.55078 22 6.81078 22 12.0008C22 14.9908 20.68 17.6708 18.6 19.5008ZM4 12.0008C4 9.48078 5.17 7.23078 7 5.77078V8.50078H9V2.50078H3V4.50078H5.4C3.32 6.33078 2 9.01078 2 12.0008C2 17.1908 5.95 21.4508 11 21.9508V19.9308C7.06 19.4408 4 16.0708 4 12.0008ZM16.24 8.11078L10.58 13.7708L7.75 10.9408L6.34 12.3508L10.58 16.5908L17.65 9.52078L16.24 8.11078Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M12 6V2L7 7L12 12V8C15.31 8 18 10.69 18 14C18 17.31 15.31 20 12 20C8.69 20 6 17.31 6 14H4C4 18.42 7.58 22 12 22C16.42 22 20 18.42 20 14C20 9.58 16.42 6 12 6Z"})),(0,i.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{d:"M16 9V19H8V9H16ZM14.5 3H9.5L8.5 4H5V6H19V4H15.5L14.5 3ZM18 7H6V19C6 20.1 6.9 21 8 21H16C17.1 21 18 20.1 18 19V7Z"})),(0,i.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},(0,i.createElement)(o.Path,{d:"M4 10.5h16V9H4v1.5ZM4 15h9v-1.5H4V15Z"}))),_=({disabled:e,setPrompt:t})=>{const{toggleHighlight:n}=S(),{selectedText:s}=P(),r=(0,a.useSelect)((e=>e("core/block-editor").getSelectedBlockClientIds()),[]);(0,c.useEffect)((()=>()=>{n(r,{isHighlighted:!1})}),[r,n]);const l=[{label:(0,d.__)("Improve writing","extendify-local"),promptType:"improve-writing",systemMessageKey:"edit",icon:(0,i.createElement)(y.Z,{icon:x.Z})},{label:(0,d.__)("Fix spelling & grammar","extendify-local"),promptType:"fix-spelling-grammar",icon:(0,i.createElement)(y.Z,{icon:w.Z})},{label:(0,d.__)("Simplify language","extendify-local"),promptType:"simplify-language",icon:(0,i.createElement)(y.Z,{icon:b.Z})},{label:(0,d.__)("Make shorter","extendify-local"),promptType:"make-shorter",icon:(0,i.createElement)(y.Z,{icon:C})},{label:(0,d.__)("Make longer","extendify-local"),promptType:"make-longer",icon:(0,i.createElement)(y.Z,{icon:E.Z})}];return(0,i.createElement)(o.MenuGroup,null,l.map((({label:a,promptType:l,icon:c})=>(0,i.createElement)(o.MenuItem,{key:`${l}-${l}-edit`,onClick:()=>(e=>{t({text:s,promptType:e,systemMessageKey:"edit"})})(l),onMouseEnter:()=>n(r,{isHighlighted:!0}),onMouseLeave:()=>n(r,{isHighlighted:!1}),icon:c,iconPosition:"left",disabled:e,className:"group"},(0,i.createElement)("span",{className:"whitespace-normal text-left rtl:text-right"},a)))))};var k=n(2278),A=n(3708),V=n(3967),L=n.n(V),M=n(3689),R=n(3773);const D=({value:e,className:t,onChange:n,onKeyDown:s,disabled:r,placeholder:o})=>{const a=(0,c.useRef)(null),[l,u]=(0,c.useState)("auto");return(0,c.useLayoutEffect)((()=>{const t=document.createElement("textarea");t.value=e||o,t.rows=1;const n=window.getComputedStyle(a.current);["paddingTop","paddingBottom","paddingLeft","paddingRight","width","fontFamily","fontSize","borderWidth"].forEach((e=>t.style[e]=n[e])),Object.assign(t.style,{position:"absolute",left:"-9999px"}),document.body.appendChild(t),u(`${t.scrollHeight}px`),document.body.removeChild(t)}),[e,o]),(0,c.useEffect)((()=>{const e=a.current;if(!e)return;if(document.activeElement===e)return;const t=e.value.length;e.focus(),e.setSelectionRange(t,t)}),[e]),(0,i.createElement)(M.M,null,(0,i.createElement)(R.E.div,{className:"m-0.5 w-full",key:"input",animate:{height:l},transition:{duration:.2},style:{lineHeight:0}},(0,i.createElement)("label",{htmlFor:"draft-ai-textarea",className:"sr-only"},o),(0,i.createElement)("textarea",{ref:a,id:"draft-ai-textarea",disabled:r,className:t,value:e,rows:1,onChange:n,onKeyDown:s,onScroll:e=>{e.target.scrollTop=0},placeholder:o})))},I=({inputText:e,setInputText:t,ready:n,setReady:s,setPrompt:r,loading:a})=>{const{selectedText:l}=P(),c=i=>{i.preventDefault(),n&&!a&&(t(""),s(!1),r({text:l||e,promptType:l?"custom-requests":"create",systemMessageKey:l?"edit":"generate",details:{followup:l?e:void 0}}))};return(0,i.createElement)("form",{className:"relative flex items-start",onSubmit:c},(0,i.createElement)(y.Z,{icon:T,className:"absolute left-2 top-3.5 h-5 w-5 fill-current text-wp-theme-main rtl:left-auto rtl:right-2"}),(0,i.createElement)(D,{disabled:a,placeholder:a?(0,d.__)("AI is writing...","extendify-local"):l?(0,d.__)("Ask AI to edit","extendify-local"):(0,d.__)("Ask AI to generate text","extendify-local"),value:e,className:"h-full w-full resize-none overflow-hidden rounded-none border-transparent bg-transparent px-10 py-3 outline-none focus:ring-1 focus:ring-wp-theme-main",onChange:e=>{t(e.target.value),s(e.target.value.length>0)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),c(e))}}),a&&(0,i.createElement)("div",{className:"absolute right-4 top-3.5 h-4 w-4 p-1 text-gray-700 rtl:left-4 rtl:right-auto"},(0,i.createElement)(o.Spinner,{style:{margin:"0"}})),!a&&(0,i.createElement)("button",{type:"submit",disabled:!n,"aria-label":(0,d.__)("Submit","extendify-local"),className:L()("absolute right-2 top-3.5 border-none bg-transparent p-0 rtl:left-2 rtl:right-auto",{"cursor-pointer text-gray-700 hover:text-design-main":n,"text-gray-500":!n})},(0,i.createElement)(y.Z,{icon:(0,d.isRTL)()?k.Z:A.Z,onClick:c,className:"h-6 w-6 fill-current"})))};var B=n(444),j=n(5893);const N=(0,j.jsx)(B.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,j.jsx)(B.Path,{d:"M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"})}),O=(0,j.jsx)(B.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,j.jsx)(B.Path,{d:"M2 12c0 3.6 2.4 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.5 0-4.5-1.5-4.5-4s2-4.5 4.5-4.5h3.5V6H8c-3.6 0-6 2.4-6 6zm19.5-1h-8v1.5h8V11zm0 5h-8v1.5h8V16zm0-10h-8v1.5h8V6z"})}),F=(0,j.jsx)(B.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,j.jsx)(B.Path,{d:"M9 12h2v-2h2V8h-2V6H9v2H7v2h2v2zm1 4c3.9 0 7-3.1 7-7s-3.1-7-7-7-7 3.1-7 7 3.1 7 7 7zm0-12c2.8 0 5 2.2 5 5s-2.2 5-5 5-5-2.2-5-5 2.2-5 5-5zM3 19h14v-2H3v2z"})}),H=(0,j.jsx)(B.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,j.jsx)(B.Path,{d:"M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"})}),Z=(0,j.jsx)(B.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,j.jsx)(B.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),U=({prompt:e,completion:t,loading:n,setPrompt:l,setInputText:u})=>{const{toggleHighlight:h,toggleInsertionPoint:m}=S(),{insertBlocks:p,replaceBlocks:f}=(0,a.useDispatch)(s.store),{getSelectedBlock:g,getSelectedBlockClientIds:v,getBlockRootClientId:x,getBlockIndex:w,getBlock:b}=(0,a.useSelect)((e=>e(s.store)),[]),E=g(),P=v(),T=e=>{const t=(0,r.pasteHandler)({plainText:e});return Array.isArray(t)?t:[(0,r.createBlock)("core/paragraph",{content:t})]},C=({replaceContent:e=!1,position:n})=>{l({text:"",promptType:"",systemMessageKey:""});const i=E?E?.clientId:P[0],s=b(i),r=T(t);if(!i||"end"===n)return void p(r);if("top"===n)return void p(r,0);const o=""===s?.attributes?.content,a=x(i),c=w(P.at(-1),a);if(!e&&!o)return void p(r,c+1,a);const u=(e,t)=>Object.prototype.hasOwnProperty.call(e?.attributes,"content")&&Object.prototype.hasOwnProperty.call(t?.attributes,"content"),d=1===r.length&&u(s,r[0]),h=r.map((e=>({...e,name:d?s.name:e.name,attributes:{...s.attributes,content:(u(e,s),e?.attributes?.content)}})));f(P,h)};return(0,c.useEffect)((()=>()=>{h(P,{isHighlighted:!1})}),[P,h]),(0,i.createElement)(o.MenuGroup,null,(0,i.createElement)(o.MenuItem,{onClick:()=>C({replaceContent:!0}),onMouseEnter:()=>h(P,{isHighlighted:!0}),onMouseLeave:()=>h(P,{isHighlighted:!1}),disabled:n||!(()=>{const e=E||b(P[0]);if(!e)return!1;if(["core/list-item","core/button"].includes(e?.name)){const n=T(t);return n[0]?.name===e?.name}return!0})(),icon:N,iconPosition:"left","data-test":"replace-selected"},(0,d.__)("Replace selected block text","extendify-local")),(0,i.createElement)(o.MenuItem,{onClick:()=>C({replaceContent:!1,position:"top"}),disabled:n,iconPosition:"left","data-test":"insert-top"},(0,i.createElement)("div",{className:(0,d.isRTL)()?"-mr-1":"-ml-1"},(0,i.createElement)(y.Z,{icon:O,className:"rotate-180"})),(0,i.createElement)("div",{className:"px-1"},(0,d.__)("Insert at top","extendify-local"))),(0,i.createElement)(o.MenuItem,{onClick:()=>C({replaceContent:!1}),onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),disabled:n||!(()=>{const e=E||b(P[0]);return!e||!["core/list-item","core/button"].includes(e?.name)})(),icon:F,iconPosition:"left","data-test":"insert-after"},(0,d.__)("Insert after the selected text","extendify-local")),(0,i.createElement)(o.MenuItem,{onClick:()=>C({replaceContent:!1,position:"end"}),disabled:n,icon:O,iconPosition:"left","data-test":"insert-bottom"},(0,d.__)("Insert at bottom","extendify-local")),(0,i.createElement)(o.__experimentalDivider,null),(0,i.createElement)(o.MenuItem,{onClick:()=>{u(""),l({text:"",promptType:"",systemMessageKey:""}),setTimeout((()=>l(e)))},disabled:n,icon:H,iconPosition:"left","data-test":"try-again-button"},(0,d.__)("Try again","extendify-local")),(0,i.createElement)(o.MenuItem,{onClick:()=>{u(""),l({text:"",promptType:"",systemMessageKey:""})},disabled:n,icon:Z,iconPosition:"left","data-test":"discard-button"},(0,d.__)("Discard","extendify-local")))};var z=n(4896);const $=({loading:e})=>{const[t,n]=(0,c.useState)(),{clearSelectedBlock:r}=(0,a.useDispatch)(s.store),{selectedText:l}=P();if((0,c.useEffect)((()=>{n(l)}),[n,l]),t)return(0,i.createElement)("div",{className:"mb-4 flex space-x-2 overflow-hidden rounded-sm border-none bg-gray-100 p-3","data-test":"existing-text-container"},(0,i.createElement)("div",null,(0,i.createElement)(y.Z,{icon:z.Z,className:"fill-current"})),(0,i.createElement)("div",null,(0,i.createElement)("div",{className:"mb-1 hyphens-auto text-pretty text-gray-800",dangerouslySetInnerHTML:{__html:t.split(" ").length<=20?t:`${t.split(" ",14).join(" ")}... ${t.slice(t.lastIndexOf(" ")-14)}`}}),(0,i.createElement)("div",{className:"mt-3 flex w-full justify-end"},(0,i.createElement)(o.Button,{size:"compact",onClick:r,disabled:e,icon:Z,iconPosition:(0,d.isRTL)()?"right":"left",className:"relative cursor-pointer flex-row-reverse rounded bg-gray-300 text-gray-800 hover:bg-gray-400","data-test":"remove-selection"},(0,d.__)("Remove selection","extendify-local")))))};var G=n(6989),W=n.n(G),K=n(7403),q=n(270),Y=n(782);const X="/extendify/v1/draft/user-settings",J={getItem:async()=>await W()({path:X}),setItem:async(e,t)=>await W()({path:X,method:"POST",data:{state:t}})},Q={aiImageOptions:{prompt:"",style:"vivid",size:"1024x1024"},imageCredits:{remaining:10,total:10,refresh:void 0}},ee=(0,Y.mW)((e=>({...Q,...(0,K.a)(window.extDraftData?.globalState)?.state,updateImageCredits({remaining:t,total:n,refresh:i}){e((e=>({imageCredits:{...e.imageCredits,...t&&{remaining:t},...n&&{total:n},...i&&{refresh:i}}})))},subtractOneCredit(){e((e=>({imageCredits:{...e.imageCredits,remaining:e.imageCredits.remaining-1,refresh:new Date(Date.now()+864e5).getTime()}})))},resetImageCredits(){e({imageCredits:Q.imageCredits})},setAiImageOption(t,n){e((e=>({aiImageOptions:{...e.aiImageOptions,[t]:n}})))}})),{name:"Extendify Draft Globals"}),te=(0,Y.tJ)(ee,{name:"extendify_draft_settings",storage:(0,Y.FL)((()=>J)),skipHydration:!0,partialize:e=>({...e,aiImageOptions:{...e.aiImageOptions,prompt:""}})}),ne=(0,q.Ue)(te);var ie=n(2200);const se=["siteId","partnerId","wpVersion","wpLanguage","devbuild","isBlockTheme","userId"],{showAIConsent:re,userGaveConsent:oe}=p.y.getState(),ae={...Object.fromEntries(Object.entries(window.extSharedData).filter((([e])=>se.includes(e)))),showAIConsent:re,userGaveConsent:oe};var le=n(6993);const ce=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)("path",{fillRule:"evenodd",d:"M1.33333 1h9.33337c.1841 0 .3333.14924.3333.33333v5.57118L9.0152 4.97484c-.19406-.18867-.50302-.18867-.69708 0L5.93734 7.28948 3.98622 6.02487c-.17383-.11267-.39915-.10648-.56653.01557L1 7.8048V1.33333C1 1.14924 1.14924 1 1.33333 1ZM1 9.04241v1.62429c0 .1841.14924.3333.33333.3333h9.33337c.1841 0 .3333-.1492.3333-.3333V8.26877l-.0152.01565-2.31814-2.25373-2.31813 2.25373c-.16726.16261-.42473.18796-.62049.06108L3.73095 7.05109 1 9.04241ZM0 1.33333C0 .596954.596954 0 1.33333 0h9.33337C11.403 0 12 .596954 12 1.33333v9.33337C12 11.403 11.403 12 10.6667 12H1.33333C.596954 12 0 11.403 0 10.6667V1.33333Z",clipRule:"evenodd"})),ue=({usedCredits:e,total:t})=>e{const{imageCredits:n,resetImageCredits:s,aiImageOptions:r,setAiImageOption:a}=ne(),l=n.total-n.remaining,[u,h]=(0,c.useState)(0),{size:m,prompt:p}=r;return(0,c.useEffect)((()=>{const e=()=>{h((e=>e+1)),n.refresh&&(new Date(Number(n.refresh))>new Date||s())};0===u&&e();const t=setTimeout(e,1e3);return()=>clearTimeout(t)}),[n,s,u]),(0,i.createElement)(i.Fragment,null,e?null:(0,i.createElement)("div",null,(0,i.createElement)(o.TextareaControl,{id:"draft-ai-image-textarea",autoFocus:!0,placeholder:(0,d.__)("Tell AI about the image you would like to create","extendify-local"),label:(0,d.__)("Image Prompt","extendify-local"),hideLabelFromVision:!0,rows:"7",value:p,onChange:e=>a("prompt",e)}),(0,i.createElement)(o.__experimentalToggleGroupControl,{isBlock:!0,label:(0,d.__)("Aspect Ratio","extendify-local"),onChange:e=>a("size",e),value:m},(0,i.createElement)(o.__experimentalToggleGroupControlOptionIcon,{className:"m-auto",type:"button",icon:pe,label:(0,d.__)("Square: 1:1","extendify-local"),value:"1024x1024"}),(0,i.createElement)(o.__experimentalToggleGroupControlOptionIcon,{className:"m-auto",type:"button",icon:he,label:(0,d.__)("Landscape: 4:3","extendify-local"),value:"1792x1024"}),(0,i.createElement)(o.__experimentalToggleGroupControlOptionIcon,{className:"m-auto",type:"button",icon:me,label:(0,d.__)("Portrait: 3:4","extendify-local"),value:"1024x1792"}))),t.length>0&&(0,i.createElement)("p",{className:"mb-0 text-red-500"},t),(0,i.createElement)(o.Button,{type:"submit",className:"w-full justify-center",variant:"primary",__next40pxDefaultSize:!0,disabled:e||!p||l>=n.total},e?(0,d.__)("Generating image...","extendify-local"):(0,d.__)("Generate image","extendify-local")),e?null:(0,i.createElement)(ue,{usedCredits:l,total:n.total}))},he=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{padding:"7px 4px"}},(0,i.createElement)("path",{fillRule:"evenodd",d:"M0 1c0-.552285.447715-1 1-1h14c.5523 0 1 .447715 1 1v8c0 .55228-.4477 1-1 1H1c-.552285 0-1-.44772-1-1V1Z",clipRule:"evenodd"})),me=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{padding:"4px 6px"}},(0,i.createElement)("path",{fillRule:"evenodd",d:"M9.66669 3.5e-7C10.219 3.7e-7 10.6667.447716 10.6667 1v14c0 .5523-.4477 1-1.00001 1h-8c-.55229 0-1.000003-.4477-1.000003-1L.666688 1C.666688.447715 1.1144-2e-8 1.66669 0l8 3.5e-7Z",clipRule:"evenodd"})),pe=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{padding:"6px"}},(0,i.createElement)("path",{fillRule:"evenodd",d:"M11.3333-4e-8c.5523 2e-8 1 .44771504 1 1.00000004v10c0 .5523-.4477 1-1 1H1.33333c-.552283 0-.999998-.4477-.999998-1V.999999C.333332.447715.781047-5e-7 1.33333-4.8e-7L11.3333-4e-8Z",clipRule:"evenodd"})),fe=e=>new Promise(((t,n)=>{e.onload=()=>t(e),e.onerror=e=>n(e)})),ge=async(e,t,n,i,s={alt:"",caption:""})=>{let r;await((e,t,n={})=>fetch(`${ie.Yy}/api/draft/image/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,source:t,...n})}))(e,n,{unsplashId:i});try{r=await(async(e,t={})=>{var n,i;const s=new Image;s.src=e,s.crossOrigin="anonymous",await fe(s);const r=document.createElement("canvas");r.width=s.width,r.height=s.height;const o=r.getContext("2d");if(!o)return;o.drawImage(s,0,0);const a=await new Promise((e=>{r.toBlob((t=>{t&&e(t)}),"image/jpeg")})),l=new FormData;return l.append("file",new File([a],t.filename)),l.append("alt_text",null!==(n=t.alt)&&void 0!==n?n:""),l.append("caption",null!==(i=t.caption)&&void 0!==i?i:""),l.append("status","publish"),await W()({path:"wp/v2/media",method:"POST",body:l})})(t,{alt:s.alt,filename:"image.jpg",caption:s.caption})}catch(e){r=await(async(e,t={})=>{var n,i;const s=new FormData;return s.append("source",e),s.append("alt_text",null!==(n=t.alt)&&void 0!==n?n:""),s.append("caption",null!==(i=t.caption)&&void 0!==i?i:""),await W()({path:"/extendify/v1/draft/upload-image",method:"POST",body:s})})(t,{alt:s.alt,filename:"image.jpg",caption:s.caption})}return r},ve=(e,t,n)=>{if("core/image"===e.name&&n(e.clientId,{id:t.id,caption:t.caption.raw,url:t.source_url,alt:t.alt_text}),"core/media-text"===e.name&&n(e.clientId,{mediaId:t.id,caption:t.caption.raw,mediaUrl:t.source_url,mediaAlt:t.alt_text,mediaType:"image"}),"core/gallery"===e.name){const n=(0,r.createBlock)("core/image",{id:t.id,caption:t.caption.raw,url:t.source_url,alt:t.alt_text});(0,r.insertBlock)(n,null,e.clientId)}"core/cover"===e.name&&n(e.clientId,{id:t.id,url:t.source_url,alt:t.alt_text,backgroundType:"image",dimRatio:50,hasParallax:!1,isDark:!0,isRepeated:!1,layout:{type:"constrained"},tagName:"div",useFeaturedImage:!1})},ye=({prompt:e,size:t,isGenerating:n,id:r,src:u,clearImageResponse:h})=>{const{openGeneralSidebar:m}=(0,a.useDispatch)(l.store),{updateBlockAttributes:p}=(0,a.useDispatch)(s.store),[f,g]=(0,c.useState)(!1),v=(0,a.useSelect)((e=>e(s.store).getSelectedBlock()),[]),[y,x]=t.split("x");return""!==u||n?(0,i.createElement)("div",{className:"flex flex-col gap-5"},(0,i.createElement)(M.M,null,n?(0,i.createElement)(R.E.div,{initial:{opacity:1},exit:{opacity:0},className:"flex aspect-square w-full items-center justify-center",style:{background:"linear-gradient(135deg, #E8E8E8 47.92%, #F3F3F3 60.42%, #E8E8E8 72.92%)"}},(0,i.createElement)(o.Spinner,{style:{height:"48px",width:"48px"}})):(0,i.createElement)(R.E.div,{initial:{opacity:0},animate:{opacity:1},className:"bg-gray-100",style:{aspectRatio:Number(y)/Number(x)}},(0,i.createElement)("img",{alt:e,src:u,className:"block w-full",style:{aspectRatio:Number(y)/Number(x)}}))),n?(0,i.createElement)("p",null,(0,d.__)("Generating your image: ","extendify-local"),(0,i.createElement)("span",{className:"font-bold"},'"',e,'"')):(0,i.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g(!0);const t=await ge(r,u,"ai-generated");t&&(await ve(v,t,p),g(!1),m("edit-post/block"),h())},className:"flex flex-col gap-5"},(0,i.createElement)(o.Button,{type:"submit",autoFocus:!0,className:"w-full justify-center",variant:"primary",disabled:f},f? // translators: "Importing image" means the image is being added to the WordPress post editor (0,d.__)("Importing image...","extendify-local"):(0,d.__)("Use this image","extendify-local")),(0,i.createElement)(o.Button,{className:"w-full justify-center bg-gray-200 text-gray-800 disabled:bg-gray-300 disabled:text-gray-700",onClick:h,disabled:f},(0,d.__)("Delete image","extendify-local")))):null},xe=(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"12",fill:"none"},(0,i.createElement)("path",{fill:"#1E1E1E",fillRule:"evenodd",d:"M6.445 12.004.986 6l5.46-6.005 1.109 1.01L3.014 6l4.541 4.995-1.11 1.01Z",clipRule:"evenodd"})),we=("AI Image",be=e=>({imageDetails:{src:"",id:void 0},setImageDetails:t=>{e((e=>({...e,imageDetails:t})))}}),(0,q.Ue)((0,Y.mW)(be,{name:"Extendify Draft AI Image"})));var be;const Ee=[{slug:"ai-image",title:(0,d.__)("AI Image","extendify-local"),component:()=>{const{imageCredits:e,updateImageCredits:t,subtractOneCredit:n,aiImageOptions:s}=ne(),[r,a]=(0,c.useState)(!1),[l,u]=(0,c.useState)(""),h=(0,c.useRef)(null),m=0===e.remaining,{imageDetails:p,setImageDetails:f}=we(),{goBack:g}=De();return(0,c.useEffect)((()=>{p.src||r||document.getElementById("draft-ai-image-textarea")?.focus()}),[p.src,r]),(0,i.createElement)(o.Panel,null,(0,i.createElement)("div",{className:"flex h-12 items-center gap-1 pl-1"},(0,i.createElement)("button",{className:"h-9 w-9 cursor-pointer border-0 bg-transparent",onClick:g,type:"button","aria-label":(0,d.__)("Go Back","extendify-local")},xe),(0,i.createElement)(o.__experimentalHeading,{className:"mb-0"},(0,d.__)("AI Image Generator","extendify-local"))),(0,i.createElement)(o.PanelBody,{className:"-mt-4 border-t-0"},(0,i.createElement)(o.BaseControl,{label:(0,d.__)("Image Description","extendify-local")},(0,i.createElement)(ye,{prompt:s.prompt,size:s.size,isGenerating:r,id:p?.id,src:p?.src,clearImageResponse:()=>f({src:"",id:void 0})}),p.src?null:(0,i.createElement)("form",{onSubmit:async i=>{if(i.preventDefault(),u(""),m)h.current?.abort();else try{a(!0),n(),h.current=new AbortController;const{imageCredits:e,images:i,id:r}=await(async(e,t)=>{const n=await fetch(`${ie.Yy}/api/draft/image`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},signal:t,body:JSON.stringify({...e,globalState:ne.getState(),...ae})}),i=await n.json(),s={remaining:n.headers.get("x-ratelimit-remaining"),total:n.headers.get("x-ratelimit-limit"),refresh:n.headers.get("x-ratelimit-reset")};if(!n.ok){if(i.status&&"content-policy-violation"===i.status)throw{message:(0,d.__)("Your request was rejected as a result of our safety system. Your prompt may contain text that is not allowed by our safety system.","extendify-local"),imageCredits:s};throw{message:(0,d.__)("Service temporarily unavailable","extendify-local"),imageCredits:s}}return{images:i,imageCredits:s,id:n.headers.get("x-request-id")}})(s,h.current.signal);t(e),f({src:i[0].url,id:r})}catch(n){if(20===n?.code)return;if(!n?.imageCredits)return await new Promise((e=>setTimeout(e,1e3))),u(n.message),void t({remaining:e.remaining});t(n.imageCredits),u(n.message)}finally{a(!1)}},className:"flex flex-col gap-5"},(0,i.createElement)(de,{isGenerating:r,errorMessage:l})))))}}],Se=[{slug:"home",title:(0,d.__)("Home","extendify-local"),component:()=>{const{navigateTo:e}=De();return(0,i.createElement)(o.PanelBody,null,(0,i.createElement)(o.BaseControl,{id:"extendify-draft-image-gen",label:(0,d.__)("AI Image Generator","extendify-local"),help:(0,d.__)("Use AI to generate custom images based on your description.","extendify-local")},(0,i.createElement)(o.Button,{variant:"primary",__next40pxDefaultSize:!0,id:"extendify-draft-image-gen-button",className:"w-full justify-center",onClick:()=>e("ai-image")},(0,d.__)("Add a prompt","extendify-local"))),(0,i.createElement)(o.__experimentalSpacer,{marginY:"5"}),(0,i.createElement)(o.__experimentalDivider,null),(0,i.createElement)(o.BaseControl,{id:"extendify-draft-image-stock-photos",label:(0,d.__)("Discover Stock Photos","extendify-local"),help:(0,d.__)("Search and add free stock photos from Unsplash.com","extendify-local")},(0,i.createElement)(o.Button,{variant:"primary",__next40pxDefaultSize:!0,className:"w-full justify-center",onClick:()=>e("unsplash")},(0,d.__)("Search Unsplash","extendify-local"))))}}],Pe=({image:e,skeletonHeight:t,isInsertingImage:n,onClick:s})=>{const[r,a]=(0,c.useState)(""),[l,u]=(0,c.useState)(!1),d=e?.width?Number(e?.width)/Number(e?.height):122/t;return(0,c.useEffect)((()=>{if(!e?.user?.links?.html)return void a("");const t=new URL(e.user.links.html);t.searchParams.set("utm_source","extendify"),t.searchParams.set("utm_medium","referral"),a(t.toString())}),[e]),(0,c.useInsertionEffect)((()=>{if(!e?.urls||l)return;const t=new Image;t.src=e.urls.thumb||e.urls.small,fe(t).then((()=>u(!0)))}),[e,l]),(0,i.createElement)(R.E.div,{className:"relative mb-1",initial:{aspectRatio:d},animate:{aspectRatio:d}},(0,i.createElement)(M.M,null,l?null:(0,i.createElement)(R.E.div,{className:"absolute inset-0 z-10 bg-white",initial:{opacity:1},animate:{opacity:1},exit:{opacity:0}},(0,i.createElement)("div",{className:"animate-pulse absolute inset-0 z-10 bg-gray-150"}))),(0,i.createElement)("div",{className:"group relative"},(0,i.createElement)("button",{type:"button",className:L()("relative block border-0 p-0",{"cursor-pointer bg-transparent":!n,"bg-black":n}),onClick:()=>s(e),disabled:n},n&&n?.id===e?.id&&(0,i.createElement)("div",{className:"absolute inset-0 flex items-center justify-center"},(0,i.createElement)(o.Spinner,{style:{height:"24px",width:"24px"}})),(0,i.createElement)("img",{src:e?.urls?.thumb||e?.urls?.small,className:L()("block transition-opacity duration-300",{"opacity-50":n}),alt:e?.alt_description})),e?.user?.name&&r?(0,i.createElement)("a",{href:r,target:"_blank",className:L()("absolute bottom-1 bg-black/70 px-1 text-white no-underline opacity-0",{"group-focus-within:opacity-100 group-hover:opacity-100":!n}),rel:"noopener noreferrer"},`${e.user?.name}`):null))},Te=({images:e,isInsertingImage:t,onClick:n,loading:s})=>{var r;const o=null!==(r=e?.length)&&void 0!==r?r:10;return s||e.length?(0,i.createElement)("div",{className:"columns-2 gap-1"},Array.from({length:o}).map(((s,r)=>{var o;const a=[150,175,200];return(0,i.createElement)(Pe,{key:null!==(o=e?.[r]?.id)&&void 0!==o?o:r,image:e?.[r],skeletonHeight:a[r%a.length],isInsertingImage:t,onClick:n})}))):(0,d.__)("No images found.","extendify-local")};var Ce=n(9272),_e=n(619),ke=n(9870);const Ae=async e=>{const t=_e.f.getState();return"unsplash"!==e||t.isEmpty()||t.hasExpired()?await(0,Ce._)(e):t.images},Ve=[...Se,...Ee,{slug:"unsplash",title:(0,d.__)("Unsplash","extendify-local"),component:()=>{const{goBack:e}=De(),[t,n]=(0,c.useState)(""),[r,l]=(0,c.useState)(""),[u,h]=(0,c.useState)(!1),{data:m,loading:p}=(e=>{const{data:t,error:n}=(0,ke.Z)(e||"unsplash",Ae);return{data:t,error:n,loading:!t&&!n}})(r),[f,g]=(0,c.useState)(null),v=(0,a.useSelect)((e=>e(s.store).getSelectedBlock()),[]),{updateBlockAttributes:y}=(0,a.useDispatch)(s.store);return(0,c.useEffect)((()=>{h(!1)}),[r]),(0,c.useEffect)((()=>{if(!t)return l("");const e=setTimeout((()=>l(t)),750);return()=>clearTimeout(e)}),[t]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)("div",{className:"flex h-12 items-center gap-1 pl-1"},(0,i.createElement)("button",{className:"h-9 w-9 cursor-pointer border-0 bg-transparent",onClick:e,type:"button","aria-label":(0,d.__)("Go Back","extendify-local")},xe),(0,i.createElement)(o.__experimentalHeading,{className:"mb-0"},(0,d.__)("Photos from Unsplash","extendify-local"))),(0,i.createElement)(o.__experimentalDivider,{className:"my-0 border-gray-150"}),(0,i.createElement)("div",{className:"flex flex-col gap-2 p-4"},(0,i.createElement)(o.SearchControl,{autoFocus:!0,className:L()({"pointer-events-none bg-gray-150 opacity-50":f}),disabled:f,"aria-disabled":f,onChange:e=>{f||n(e)},value:t}),(0,i.createElement)(Te,{images:m,isInsertingImage:f,onClick:async e=>{if(!f){g(e);try{const t=await ge(e.requestMetadata?.id,e.urls?.regular,"unsplash",e.id);ve(v,t,y)}catch(e){console.log(e)}finally{g(null)}}},loading:p||u})))}}],Le="/extendify/v1/draft/router-data",Me={getItem:async()=>await W()({path:Le}),setItem:async(e,t)=>await W()({path:Le,method:"POST",data:{state:t}})},Re=(0,q.Ue)((0,Y.tJ)((0,Y.mW)(((e,t)=>({history:[],viewedPages:[],current:null,goBack:()=>{if(t().history.length<2)return;const n=t().history[1];le.j.getState().incrementActivity(`draft-${n.slug}-back`),e((e=>({history:e.history.slice(1),current:n})))},setCurrent:n=>{n&&t().history[0]?.slug!==n.slug&&e((e=>{const t=(new Date).toISOString(),i=t,s=e.viewedPages.find((e=>e.slug===n.slug));return{history:[n,...e.history].filter(Boolean),current:n,viewedPages:[...e.viewedPages.filter((e=>e.slug!==n.slug)),s?{...s,count:s.count+1,lastViewedAt:t}:{slug:n.slug,firstViewedAt:i,lastViewedAt:t,count:1}]}}))}})),{name:"Extendify Draft Router"}),{name:"extendify-draft-router",storage:(0,Y.FL)((()=>Me)),skipHydration:!0,partialize:({viewedPages:e})=>({viewedPages:e})})),De=()=>{var e;const{current:t,setCurrent:n,history:s,goBack:r}=Re(),o=null!==(e=t?.component)&&void 0!==e?e:()=>null;return(0,c.useEffect)((()=>{t||n(Ve[0])}),[t,n]),{current:t,CurrentPage:(0,c.useCallback)((()=>(0,i.createElement)("div",{role:"region","aria-live":"polite",className:"h-full"},(0,i.createElement)("h1",{className:"sr-only"},t?.title),(0,i.createElement)(o,null))),[t]),navigateTo:e=>{const t=Ve.find((t=>t.slug===e));if(!t)return n(Ve[0]);le.j.getState().incrementActivity(`draft-${t.slug}`),n(t)},goBack:r,history:s}},Ie=()=>{const{consentTermsHTML:e,setUserGaveConsent:t}=(0,p.y)();return(0,i.createElement)(o.Panel,null,(0,i.createElement)("div",{className:"p-4"},(0,i.createElement)("h2",{className:"mb-2 mt-0 text-lg"},(0,d.__)("Terms of Use","extendify-local")),(0,i.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:e}}),(0,i.createElement)("button",{className:"mt-4 w-full cursor-pointer rounded border-0 bg-wp-theme-main px-4 py-2 text-center text-white",type:"button",onClick:()=>t(!0),"data-test":"draft-terms-button"},(0,d.__)("Accept","extendify-local"))))},Be=()=>{var e;const{selectedText:t}=P(),[n,r]=(0,c.useState)(""),[l,u]=(0,c.useState)(!1),[h,m]=(0,c.useState)({text:"",promptType:"",systemMessageKey:"",details:{}}),{completion:g,loading:y,error:x}=((e,t,n,i)=>{const[s,r]=(0,c.useState)(""),[o,a]=(0,c.useState)(null),[l,u]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{let s,o=!1;const l=new TextDecoder;return e?((async()=>{r(""),a(!1),u(!0);const c=await(async(e,t,n,i)=>{const s=await fetch(`${ie.Yy}/api/draft/completion`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,promptType:t,systemMessageKey:n,details:i,globalState:ne.getState(),...ae})});if(!s.ok)throw new Error((0,d.__)("Service temporarily unavailable","extendify-local"));return s})(e,t,n,i);s=c.body.getReader();let h=!1;for(;!h;){const{value:e,done:t}=await s.read();if(h=t,e&&!o){const t=l.decode(e);r((e=>e+t))}}})().finally((()=>{o||u(!1)})).catch((e=>{o||a(e)})),()=>{o=!0,s&&s.cancel()}):(u(!1),r(""),void(o=!0))}),[e,n,t,i]),{completion:s,error:o,loading:l}})(h.text,h.promptType,h.systemMessageKey,h.details),{selectedBlockClientIds:w,getBlock:b}=(0,a.useSelect)((e=>{const t=e(s.store);return{selectedBlockClientIds:t.getSelectedBlockClientIds(),getBlock:t.getBlock,getBlocks:t.getBlocks}}),[]),{CurrentPage:E}=De(),S=(0,p.y)((e=>e.shouldShowAIConsent("draft")));(0,c.useEffect)((()=>{const e=e=>{S||m(e.detail)};return window.addEventListener("extendify-draft:set-prompt",e),()=>window.removeEventListener("extendify-draft:set-prompt",e)}),[S]),(0,c.useEffect)((()=>{x&&r(h.text)}),[x,h.text]);const T=()=>{if(0===w.length)return!1;const e=b(w[0]);return!!e&&void 0!==e?.attributes?.content&&""!==e?.attributes?.content};return S?(0,i.createElement)(Ie,null):(()=>{if(0===w.length)return!1;const e=b(w[0]);return!!e&&["core/image","core/media-text","core/gallery","core/cover"].includes(e.name)})()?(0,i.createElement)(E,null):(0,i.createElement)(i.Fragment,null,(0,i.createElement)(o.Panel,null,(0,i.createElement)(o.PanelBody,null,t&&(0,i.createElement)($,{loading:y}),(0,i.createElement)("div",{className:"mb-4 overflow-hidden rounded-sm border-none bg-gray-100"},!g&&(0,i.createElement)(I,{inputText:n,setInputText:r,ready:l,setReady:u,setPrompt:m,loading:y}),g&&(0,i.createElement)(f,{completion:g}),x&&(0,i.createElement)("div",{className:"mb-4 mt-2 px-4"},(0,i.createElement)("p",{className:"m-0 text-xs font-semibold text-red-500"},x.message))),(g||y)&&!x&&(0,i.createElement)(U,{prompt:h,completion:g,setPrompt:m,setInputText:r,loading:y}),!y&&!g&&T()&&(0,i.createElement)(o.BaseControl,null,(0,i.createElement)(_,{completion:g,disabled:y,setInputText:r,setPrompt:m})),!y&&!g&&!T()&&(0,i.createElement)(o.BaseControl,{label:(0,d.__)("Suggested prompts","extendify-local")},(0,i.createElement)(v,{disabled:y,setInputText:r,setReady:u})))),window.extSharedData?.devbuild&&(0,i.createElement)(o.Panel,null,(0,i.createElement)(o.PanelBody,{title:"Debug",initialOpen:!1},(0,i.createElement)("label",null,"prompt text:"),(0,i.createElement)("pre",{className:"whitespace-pre-wrap"},h.text),(0,i.createElement)("label",null,"prompt system message:"),(0,i.createElement)("pre",{className:"whitespace-pre-wrap"},h.systemMessageKey),(0,i.createElement)("label",null,"completion:"),(0,i.createElement)("pre",{className:"whitespace-pre-wrap"},g),(0,i.createElement)("label",null,"error:"),(0,i.createElement)("pre",{className:"whitespace-pre-wrap"},null!==(e=x?.message)&&void 0!==e?e:""),(0,i.createElement)("label",null,"loading: ",y?(0,i.createElement)("span",null,"true"):(0,i.createElement)("span",null,"false")))))},je=(e,t)=>"function"==typeof c.createRoot?(0,c.createRoot)(t).render(e):((0,c.render)(e,t),{unmount:()=>{(0,c.unmountComponentAtNode)(t)}}),Ne=["core/image","core/media-text","core/gallery","core/cover"],Oe=()=>{const{openGeneralSidebar:e}=(0,a.useDispatch)(l.store);return(0,i.createElement)(o.MenuItem,{icon:T,onClick:async()=>{e("extendify-draft/draft"),await new Promise((e=>requestAnimationFrame(e)));const t=document.getElementById("extendify-draft-image-gen-button");t?.focus(),t?.classList.add("animate-pulse-flash")}},(0,d.__)("Get Personalized Image","extendify-local"))},Fe=()=>{const{openGeneralSidebar:e}=(0,a.useDispatch)(l.store);return(0,i.createElement)(o.ToolbarGroup,{className:"extendify-draft"},(0,i.createElement)(o.ToolbarButton,{className:"py-1.5 pl-2 pr-3 text-white before:bg-editor-main before:content-[''] hover:before:bg-editor-main-darker",icon:T,onClick:async()=>{e("extendify-draft/draft"),await new Promise((e=>requestAnimationFrame(e)));const t=document.getElementById("extendify-draft-image-gen-button");t?.focus(),t?.classList.add("animate-pulse-flash")}},(0,d.__)("Ask AI","extendify-local")))},He=({name:e,attributes:t})=>((0,c.useEffect)((()=>{if(!Ne.includes(e))return;let t,n,s,r,o;return(async()=>{await new Promise((e=>r=requestAnimationFrame(e)));const e=Array.from(document.querySelectorAll('[data-toolbar-item="true"]'))?.find((e=>e.textContent===(0,d.__)("Replace")||e.textContent===(0,d.__)("Add")));e&&(o=new MutationObserver((e=>{if("true"===e[0].target.getAttribute("aria-expanded")){const e=".block-editor-media-replace-flow__media-upload-menu",r=document.querySelector(e);if(!r)return;return t=document.createElement("div"),r.prepend(t),void(s=requestAnimationFrame((()=>{n=je((0,i.createElement)(Oe,null),t)})))}cancelAnimationFrame(s),n?.unmount(),t?.remove()})),o.observe(e,{attributes:!0,childList:!1,subtree:!1}))})(),()=>{[s,r].forEach(cancelAnimationFrame),n?.unmount(),t?.remove(),o?.disconnect()}}),[e,t]),Ne.includes(e)?(0,i.createElement)(Fe,null):null);var Ze=n(4461),Ue=n(4310),ze=n(5024);const $e=({text:e,closePopup:t,openDraft:n,updatePrompt:s})=>{const r=[{language:(0,d.__)("Arabic","extendify-local"),code:"ar",languageName:"Arabic"},{language:(0,d.__)("Arabic (Morocco)","extendify-local"),code:"ary",languageName:"Arabic (Morocco)"},{language:(0,d.__)("Bulgarian","extendify-local"),code:"bg_BG",languageName:"Bulgarian"},{language:(0,d.__)("Catalan","extendify-local"),code:"ca",languageName:"Catalan"},{language:(0,d.__)("Czech","extendify-local"),code:"cs_CZ",languageName:"Czech"},{language:(0,d.__)("Danish","extendify-local"),code:"da_DK",languageName:"Danish"},{language:(0,d.__)("Dutch","extendify-local"),code:"nl_NL",languageName:"Dutch"},{language:(0,d.__)("Dutch (Belgium)","extendify-local"),code:"de_BE",languageName:"Dutch (Belgium)"},{language:(0,d.__)("English","extendify-local"),code:"en",languageName:"English"},{language:(0,d.__)("English (UK)","extendify-local"),code:"en_GB",languageName:"English (UK)"},{language:(0,d.__)("Estonian","extendify-local"),code:"et",languageName:"Estonian"},{language:(0,d.__)("Finnish","extendify-local"),code:"fi",languageName:"Finnish"},{language:(0,d.__)("French (Belgium)","extendify-local"),code:"fr_BE",languageName:"French (Belgium)"},{language:(0,d.__)("French (Canada)","extendify-local"),code:"fr_CA",languageName:"French (Canada)"},{language:(0,d.__)("French (France)","extendify-local"),code:"fr_FR",languageName:"French (France)"},{language:(0,d.__)("German","extendify-local"),code:"de_DE",languageName:"German"},{language:(0,d.__)("German (Switzerland)","extendify-local"),code:"de_CH",languageName:"German (Switzerland)"},{language:(0,d.__)("Greek","extendify-local"),code:"el",languageName:"Greek"},{language:(0,d.__)("Hindi","extendify-local"),code:"hi_IN",languageName:"Hindi"},{language:(0,d.__)("Hungarian","extendify-local"),code:"hu_HU",languageName:"Hungarian"},{language:(0,d.__)("Indonesian","extendify-local"),code:"id_ID",languageName:"Indonesian"},{language:(0,d.__)("Italian","extendify-local"),code:"it_IT",languageName:"Italian"},{language:(0,d.__)("Japanese","extendify-local"),code:"jp",languageName:"Japanese"},{language:(0,d.__)("Norwegian","extendify-local"),code:"nb_NO",languageName:"Norwegian"},{language:(0,d.__)("Polish","extendify-local"),code:"pl_PL",languageName:"Polish"},{language:(0,d.__)("Portuguese (Brazil)","extendify-local"),code:"pt_BR",languageName:"Portuguese (Brazil)"},{language:(0,d.__)("Portuguese (Portugal)","extendify-local"),code:"pt_PT",languageName:"Portuguese (Portugal)"},{language:(0,d.__)("Romanian","extendify-local"),code:"ro_RO",languageName:"Romanian"},{language:(0,d.__)("Russian","extendify-local"),code:"ru_RU",languageName:"Russian"},{language:(0,d.__)("Slovak","extendify-local"),code:"sk_SK",languageName:"Slovak"},{language:(0,d.__)("Spanish (Spain)","extendify-local"),code:"es_ES",languageName:"Spanish (Spain)"},{language:(0,d.__)("Spanish (Colombia)","extendify-local"),code:"es_CO",languageName:"Spanish (Colombia)"},{language:(0,d.__)("Spanish (Mexico)","extendify-local"),code:"es_MX",languageName:"Spanish (Mexico)"},{language:(0,d.__)("Swedish","extendify-local"),code:"sv_SE",languageName:"Swedish"},{language:(0,d.__)("Turkish","extendify-local"),code:"tr_TR",languageName:"Turkish"},{language:(0,d.__)("Ukrainian","extendify-local"),code:"uk",languageName:"Ukrainian"},{language:(0,d.__)("Vietnamese","extendify-local"),code:"vi",languageName:"Vietnamese"}];return(0,i.createElement)(o.Dropdown,{className:"my-container-class-name flex w-full items-center justify-between",contentClassName:"my-dropdown-content-classname",popoverProps:{placement:"right-start"},renderToggle:({isOpen:e,onToggle:t})=>(0,i.createElement)("div",{className:"group flex w-full items-center justify-between hover:text-design-main"},(0,i.createElement)(o.MenuItem,{className:"flex w-full justify-between",icon:Ze.Z,iconPosition:(0,d.isRTL)()?"left":"right",variant:void 0,onClick:t,"aria-expanded":e},(0,d.__)("Translate","extendify-local")),(0,i.createElement)(y.Z,{icon:(0,d.isRTL)()?Ue.Z:ze.Z,size:24,className:"fill-current group-hover:text-current"})),renderContent:()=>(0,i.createElement)(o.MenuGroup,{className:"extendify-draft",label:(0,i.createElement)("div",{className:"flex items-center gap-2"},(0,i.createElement)(y.Z,{className:"fill-gray-900",size:16,icon:T}),(0,d.__)("Translate to...","extendify-local"))},r.map((({language:r,code:a,languageName:l,promptType:c="translate",systemMessageKey:u="edit"})=>(0,i.createElement)(o.MenuItem,{key:`${c}-${a}-${u}`,style:{width:"100%"},isSelected:!1,disabled:!1,variant:void 0,onClick:()=>{n?.(),t?.(),window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>s({text:e,promptType:c,systemMessageKey:u,details:{languageInto:l}})))))}},r))))})},Ge=["core/paragraph","core/list-item","core/verse","core/preformatted","core/heading"],We=(e,t)=>{const{clientId:n}=t,{getBlockName:r,getBlock:c}=(0,a.useSelect)((e=>e(s.store)),[]),{getActiveGeneralSidebarName:u}=(0,a.useSelect)((e=>e(l.store)),[]),{openGeneralSidebar:h}=(0,a.useDispatch)(l.store);if(!Ge.includes(r(n)))return(0,i.createElement)(e,{...t});const m=c(n)?.attributes?.content||"",p=()=>h("extendify-draft/draft"),f=e=>window.dispatchEvent(new CustomEvent("extendify-draft:set-prompt",{detail:e}));return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(e,{...t}),(0,i.createElement)(s.BlockControls,null,(0,i.createElement)(o.ToolbarGroup,{className:"extendify-draft"},(0,i.createElement)(o.Dropdown,{renderContent:({onClose:e})=>(0,i.createElement)(Ke,{text:m,closePopup:e,openDraft:p,updatePrompt:f}),renderToggle:({isOpen:e,onToggle:t})=>(0,i.createElement)(o.ToolbarButton,{className:"py-1.5 pl-2 pr-3 text-white before:bg-editor-main before:content-[''] hover:before:bg-editor-main-darker",onClick:()=>{if(!m)return"extendify-draft/draft"===u()?h("edit-post/block"):p();t()},"aria-expanded":e,"aria-haspopup":"true",iconPosition:(0,d.isRTL)()?"right":"left",icon:T},(0,d.__)("Ask AI","extendify-local"))}))))},Ke=({text:e,closePopup:t,openDraft:n,updatePrompt:s})=>{const r=[{label:(0,d.__)("Improve writing","extendify-local"),promptType:"improve-writing",systemMessageKey:"edit",icon:(0,i.createElement)(y.Z,{icon:x.Z}),disabled:()=>!1},{label:(0,d.__)("Fix spelling & grammar","extendify-local"),promptType:"fix-spelling-grammar",systemMessageKey:"edit",icon:(0,i.createElement)(y.Z,{icon:w.Z}),disabled:()=>!1},{label:(0,d.__)("Simplify language","extendify-local"),promptType:"simplify-language",systemMessageKey:"edit",icon:(0,i.createElement)(y.Z,{icon:b.Z}),disabled:()=>!1},{label:(0,d.__)("Make shorter","extendify-local"),promptType:"make-shorter",systemMessageKey:"edit",icon:(0,i.createElement)(y.Z,{icon:C}),disabled:()=>!1},{label:(0,d.__)("Make longer","extendify-local"),promptType:"make-longer",systemMessageKey:"edit",icon:(0,i.createElement)(y.Z,{icon:E.Z}),disabled:()=>!1}];return(0,i.createElement)(o.NavigableMenu,{orientation:"vertical",role:"menu",style:{minWidth:"200px"}},(0,i.createElement)(o.MenuGroup,{className:"extendify-draft"},(0,i.createElement)(o.MenuItem,{key:"custom-prompt",style:{width:"100%"},isSelected:!1,disabled:!1,iconPosition:"left",icon:T,variant:void 0,onClick:()=>{n?.(),t?.(),window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>document.getElementById("draft-ai-textarea").focus()))))}},(0,d.__)("Custom prompt","extendify-local")),r.map((({label:r,promptType:a,systemMessageKey:l,disabled:c,icon:u})=>(0,i.createElement)(o.MenuItem,{key:`${a}-${a}-${l}`,style:{width:"100%"},isSelected:!1,disabled:c(),iconPosition:(0,d.isRTL)()?"left":"right",icon:u,variant:void 0,onClick:()=>{n?.(),t?.(),window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>s({text:e,promptType:a,systemMessageKey:l})))))}},r))),(0,i.createElement)($e,{text:e,closePopup:t,openDraft:n,updatePrompt:s})))};(0,h.registerPlugin)("extendify-draft",{render:()=>(0,i.createElement)(qe,null,(0,i.createElement)(l.PluginSidebarMoreMenuItem,{target:"draft"},(0,d.__)("AI Tools","extendify-local")),(0,i.createElement)(l.PluginSidebar,{name:"draft",icon:T,title:(0,d.__)("AI Tools","extendify-local"),className:"extendify-draft h-full"},(0,i.createElement)(o.Flex,{direction:"column",expanded:!0,justify:"space-between"},(0,i.createElement)(o.FlexBlock,null,(0,i.createElement)(Be,null)))))});const qe=({children:e})=>{const{insertBlocks:t,selectBlock:n}=(0,a.useDispatch)(s.store),{navigateTo:i}=De(),{openGeneralSidebar:o}=(0,a.useDispatch)(l.store),u=(0,a.useSelect)((e=>e(l.store).getActiveGeneralSidebarName())),d=(()=>{const[e,t]=(0,c.useState)(!1),n=(0,a.useSelect)((e=>e(s.store).__unstableIsEditorReady||e(s.store).getBlockCount()>0||e(s.store).getSelectedBlockClientId())),i=(0,a.useSelect)((e=>e(m.store).__unstableIsEditorReady||e(m.store).isCleanNewPost()));return(0,c.useEffect)((()=>{const e=(0,a.subscribe)((()=>{(n||i)&&(t(!0),e())}))}),[n,i]),e})(),h=(0,c.useRef)(!1),{getBlocks:p}=(0,a.useSelect)((e=>e(s.store)),[]);return(0,c.useEffect)((()=>{const e=new URLSearchParams(window.location.search);if(!e.has("ext-add-image-block"))return;e.delete("ext-add-image-block"),window.history.replaceState({},"",window.location.pathname+"?"+e.toString()),i("ai-image");const s=p()?.find((e=>"core/image"===e.name));requestAnimationFrame((()=>s?n(s.clientId):t([(0,r.createBlock)("core/image")]))),setTimeout((()=>{document.getElementById("draft-ai-image-textarea")?.focus()}),300)}),[n,t,i,p]),(0,c.useEffect)((()=>{if(!d||h.current)return;const e=requestAnimationFrame((()=>{"extendify-draft/draft"!==u?o("extendify-draft/draft"):h.current=!0}));return()=>cancelAnimationFrame(e)}),[o,u,d]),e};(0,u.addFilter)("editor.BlockEdit","extendify-draft/draft-toolbar",(e=>t=>We(e,t))),(0,u.addFilter)("editor.BlockEdit","extendify-draft/draft-image",(e=>t=>((e,t)=>{const{openGeneralSidebar:n}=(0,a.useDispatch)(l.store),{clientId:r,name:u}=t;return(0,c.useEffect)((()=>{if(!Ne.includes(u))return;const e=document.querySelector('iframe[name="editor-canvas"]')?.contentDocument,t=e?e.querySelector(`[data-block="${r}"]`):document.querySelector(`[data-block="${r}"]`);if(!t)return;const s=Object.assign(document.createElement("div"),{className:"components-form-file-upload"});let a;t.querySelector(".block-editor-media-placeholder .components-form-file-upload")?.after(s);const l=(0,i.createElement)(i.Fragment,null,(0,i.createElement)(o.Button,{variant:"primary",__next40pxDefaultSize:!0,onClick:async()=>{n("extendify-draft/draft"),await new Promise((e=>requestAnimationFrame(e)));const e=document.getElementById("extendify-draft-image-gen-button");e?.focus(),e?.classList.add("animate-pulse-flash")}},(0,d.__)("Get Personalized Image","extendify-local")),(0,i.createElement)("span",{"aria-hidden":"true"})),c=requestAnimationFrame((()=>{a=je(l,s)}));return()=>{cancelAnimationFrame(c),a?.unmount(),s?.remove()}}),[r,n,u]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(e,{...t}),(0,i.createElement)(s.BlockControls,null,(0,i.createElement)(He,{...t})))})(e,t)))},7403:(e,t,n)=>{"use strict";n.d(t,{a:()=>i});const i=e=>{try{return JSON.parse(e)}catch(e){return{}}}},9272:(e,t,n)=>{"use strict";n.d(t,{_:()=>u,p:()=>d});var i=n(424),s=n(619),r=n(2200);const{showAIConsent:o,userGaveConsent:a}=i.y.getState(),l=["siteId","partnerId","wpVersion","wpLanguage","devbuild","isBlockTheme","userId"],c={...Object.fromEntries(Object.entries(window.extSharedData).filter((([e])=>l.includes(e)))),showAIConsent:o,userGaveConsent:a},u=async e=>{const t=new URLSearchParams({...c,query:e}),n=await fetch(`${r.Yy}/api/draft/image/unsplash?${t.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error("Bad response from server");const i=await n.json();if(!Array.isArray(i))throw new Error("Bad response from server");return i.map((e=>({...e,requestMetadata:{id:n.headers.get("X-Request-Id"),total:n.headers.get("X-Total"),perPage:n.headers.get("X-Per-Page")}})))},d=async()=>{var e;const t=s.f.getState();if(!t.isEmpty()&&!t.hasExpired())return t.images;const{aiKeywords:n}=null!==(e=window.extSharedData?.siteProfile)&&void 0!==e?e:{},i=n?.length?n:[],r=(await Promise.all(i.map(u))).flat(),o=r.reduce(((e,t)=>(e.has(t.id)||e.set(t.id,t),e)),new Map);return t.updateCache(Array.from(o.values())),r}},6993:(e,t,n)=>{"use strict";n.d(t,{j:()=>h});var i=n(6989),s=n.n(i),r=n(7403),o=n(270),a=n(782);const l="/extendify/v1/shared/activity",c={getItem:()=>s()({path:l}),setItem:(e,t)=>s()({path:l,method:"POST",data:{state:t}})},u=(0,r.a)(window.extSharedData.activity),d={actions:{}},h=(0,o.Ue)((0,a.tJ)((0,a.mW)(((e,t)=>{var n;return{...d,...null!==(n=u?.state)&&void 0!==n?n:{},incrementActivity:n=>{e((e=>({...e,actions:{...e.actions,[n]:Number(t().actions[n]||0)+1}})))}}}),{name:"Extendify Activity"}),{name:"extendify_shared_activity",storage:(0,a.FL)((()=>c)),skipHydration:!0}))},424:(e,t,n)=>{"use strict";n.d(t,{y:()=>l});var i=n(6989),s=n.n(i),r=n(270),o=n(782);const a={setItem:(e,t)=>s()({path:"/extendify/v1/shared/update-user-meta",method:"POST",data:{option:"ai_consent",value:t.state.userGaveConsent}})},l=(0,r.Ue)((0,o.tJ)((0,o.mW)(((e,t)=>{var n,i,s;return{showAIConsent:null!==(n=window.extSharedData?.showAIConsent)&&void 0!==n&&n,consentTermsHTML:null!==(i=window.extSharedData?.consentTermsHTML)&&void 0!==i?i:"",userGaveConsent:null!==(s=window.extSharedData?.userGaveConsent)&&void 0!==s&&s,setUserGaveConsent:t=>e({userGaveConsent:t}),shouldShowAIConsent:e=>{var n;const{showAIConsent:i,consentTermsHTML:s,userGaveConsent:r}=t(),o=i&&s,a={launch:o,draft:o&&!r,"help-center":o&&!r};return null!==(n=a?.[e])&&void 0!==n&&n}}}),{name:"Extendify AI Consent"}),{name:"extendify-ai-consent",storage:a,skipHydration:!0}))},619:(e,t,n)=>{"use strict";n.d(t,{f:()=>r});var i=n(270),s=n(782);const r=(0,i.Ue)((0,s.tJ)((0,s.mW)(((e,t)=>({images:[],expiration:0,isEmpty:()=>0===t().images.length,hasExpired:()=>Date.now()>t().expiration,updateCache:t=>e({images:t,expiration:Date.now()+6048e5})})),{name:"Extendify Unsplash Images"}),{name:"extendify-unsplash-images",storage:(0,s.FL)((()=>localStorage))}))},2200:(e,t,n)=>{"use strict";n.d(t,{Ow:()=>o,Yy:()=>r,kE:()=>i,nX:()=>s});const i="https://patterns.extendify.com",s="https://kb.extendify.com",r="https://ai.extendify.com",o="https://insights.extendify.com"},5251:(e,t,n)=>{"use strict";var i=n(9196),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var i,r={},c=null,u=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,i)&&!l.hasOwnProperty(i)&&(r[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===r[i]&&(r[i]=t[i]);return{$$typeof:s,type:e,key:c,ref:u,props:r,_owner:a.current}}t.Fragment=r,t.jsx=c,t.jsxs=c},5893:(e,t,n)=>{"use strict";e.exports=n(5251)},3250:(e,t,n)=>{"use strict";var i=n(9196),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=i.useState,o=i.useEffect,a=i.useLayoutEffect,l=i.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!s(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=r({inst:{value:n,getSnapshot:t}}),s=i[0].inst,u=i[1];return a((function(){s.value=n,s.getSnapshot=t,c(s)&&u({inst:s})}),[e,n,t]),o((function(){return c(s)&&u({inst:s}),e((function(){c(s)&&u({inst:s})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},139:(e,t,n)=>{"use strict";var i=n(9196),s=n(1688),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=s.useSyncExternalStore,a=i.useRef,l=i.useEffect,c=i.useMemo,u=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,i,s){var d=a(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=c((function(){function e(e){if(!l){if(l=!0,o=e,e=i(e),void 0!==s&&h.hasValue){var t=h.value;if(s(t,e))return a=t}return a=e}if(t=a,r(o,e))return t;var n=i(e);return void 0!==s&&s(t,n)?t:(o=e,a=n)}var o,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,i,s]);var m=o(e,d[0],d[1]);return l((function(){h.hasValue=!0,h.value=m}),[m]),u(m),m}},1688:(e,t,n)=>{"use strict";e.exports=n(3250)},2798:(e,t,n)=>{"use strict";e.exports=n(139)},9196:e=>{"use strict";e.exports=window.React},6989:e=>{"use strict";e.exports=window.wp.apiFetch},2175:e=>{"use strict";e.exports=window.wp.blockEditor},4981:e=>{"use strict";e.exports=window.wp.blocks},5609:e=>{"use strict";e.exports=window.wp.components},9818:e=>{"use strict";e.exports=window.wp.data},9307:e=>{"use strict";e.exports=window.wp.element},2694:e=>{"use strict";e.exports=window.wp.hooks},5736:e=>{"use strict";e.exports=window.wp.i18n},8817:e=>{"use strict";e.exports=window.wp.plugins},444:e=>{"use strict";e.exports=window.wp.primitives},3967:(e,t)=>{var n;!function(){"use strict";var i={}.hasOwnProperty;function s(){for(var e="",t=0;t{"use strict";n.d(t,{M:()=>v});var i=n(5893),s=n(9196),r=n(240),o=n(6681),a=n(6014);class l extends s.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function c({children:e,isPresent:t}){const n=(0,s.useId)(),r=(0,s.useRef)(null),o=(0,s.useRef)({width:0,height:0,top:0,left:0}),{nonce:c}=(0,s.useContext)(a._);return(0,s.useInsertionEffect)((()=>{const{width:e,height:i,top:s,left:a}=o.current;if(t||!r.current||!e||!i)return;r.current.dataset.motionPopId=n;const l=document.createElement("style");return c&&(l.nonce=c),document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`\n [data-motion-pop-id="${n}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${i}px !important;\n top: ${s}px !important;\n left: ${a}px !important;\n }\n `),()=>{document.head.removeChild(l)}}),[t]),(0,i.jsx)(l,{isPresent:t,childRef:r,sizeRef:o,children:s.cloneElement(e,{ref:r})})}const u=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:l,presenceAffectsLayout:u,mode:h})=>{const m=(0,o.h)(d),p=(0,s.useId)(),f=(0,s.useMemo)((()=>({id:p,initial:t,isPresent:n,custom:l,onExitComplete:e=>{m.set(e,!0);for(const e of m.values())if(!e)return;a&&a()},register:e=>(m.set(e,!1),()=>m.delete(e))})),u?[Math.random()]:[n]);return(0,s.useMemo)((()=>{m.forEach(((e,t)=>m.set(t,!1)))}),[n]),s.useEffect((()=>{!n&&!m.size&&a&&a()}),[n]),"popLayout"===h&&(e=(0,i.jsx)(c,{isPresent:n,children:e})),(0,i.jsx)(r.O.Provider,{value:f,children:e})};function d(){return new Map}var h=n(5364),m=n(5487);const p=e=>e.key||"";function f(e){const t=[];return s.Children.forEach(e,(e=>{(0,s.isValidElement)(e)&&t.push(e)})),t}var g=n(8868);const v=({children:e,exitBeforeEnter:t,custom:n,initial:r=!0,onExitComplete:a,presenceAffectsLayout:l=!0,mode:c="sync"})=>{(0,m.k)(!t,"Replace exitBeforeEnter with mode='wait'");const d=(0,s.useMemo)((()=>f(e)),[e]),v=d.map(p),y=(0,s.useRef)(!0),x=(0,s.useRef)(d),w=(0,o.h)((()=>new Map)),[b,E]=(0,s.useState)(d),[S,P]=(0,s.useState)(d);(0,g.L)((()=>{y.current=!1,x.current=d;for(let e=0;e{const t=p(e),s=d===S||v.includes(t);return(0,i.jsx)(u,{isPresent:s,initial:!(y.current&&!r)&&void 0,custom:s?void 0:n,presenceAffectsLayout:l,mode:c,onExitComplete:s?void 0:()=>{if(!w.has(t))return;w.set(t,!0);let e=!0;w.forEach((t=>{t||(e=!1)})),e&&(null==C||C(),P(x.current),a&&a())},children:e},t)}))})}},5364:(e,t,n)=>{"use strict";n.d(t,{p:()=>i});const i=(0,n(9196).createContext)({})},6014:(e,t,n)=>{"use strict";n.d(t,{_:()=>i});const i=(0,n(9196).createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"})},240:(e,t,n)=>{"use strict";n.d(t,{O:()=>i});const i=(0,n(9196).createContext)(null)},3773:(e,t,n)=>{"use strict";n.d(t,{E:()=>Lo});var i=n(5893),s=n(9196),r=n(6014);const o=(0,s.createContext)({});var a=n(240),l=n(8868);const c=(0,s.createContext)({strict:!1}),u=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),d="data-"+u("framerAppearId"),h=["read","resolveKeyframes","update","preRender","render","postRender"];function m(e,t){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=h.reduce(((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,i=!1,s=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(t){r.has(t)&&(l.schedule(t),e()),t(o)}const l={schedule:(e,s=!1,o=!1)=>{const a=o&&i?t:n;return s&&r.add(e),a.has(e)||a.add(e),e},cancel:e=>{n.delete(e),r.delete(e)},process:e=>{o=e,i?s=!0:(i=!0,[t,n]=[n,t],n.clear(),t.forEach(a),i=!1,s&&(s=!1,l.process(e)))}};return l}(r),e)),{}),{read:a,resolveKeyframes:l,update:c,preRender:u,render:d,postRender:m}=o,p=()=>{const r=performance.now();n=!1,s.delta=i?1e3/60:Math.max(Math.min(r-s.timestamp,40),1),s.timestamp=r,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),u.process(s),d.process(s),m.process(s),s.isProcessing=!1,n&&t&&(i=!1,e(p))};return{schedule:h.reduce(((t,r)=>{const a=o[r];return t[r]=(t,r=!1,o=!1)=>(n||(n=!0,i=!0,s.isProcessing||e(p)),a.schedule(t,r,o)),t}),{}),cancel:e=>{for(let t=0;t{S&&S.update(n,f)}));const T=(0,s.useRef)(Boolean(n[d]&&!window.HandoffComplete));return(0,l.L)((()=>{S&&(S.updateFeatures(),p.render(S.render),T.current&&S.animationState&&S.animationState.animateChanges())})),(0,s.useEffect)((()=>{S&&(!T.current&&S.animationState&&S.animationState.animateChanges(),T.current&&(T.current=!1,y||(y=!0,queueMicrotask(w))))})),S}function w(){window.HandoffComplete=!0}function b(e){if(e)return!1!==e.options.allowProjection?e.projection:b(e.parent)}function E(e,t,n){return(0,s.useCallback)((i=>{i&&e.mount&&e.mount(i),t&&(i?t.mount(i):t.unmount()),n&&("function"==typeof n?n(i):g(n)&&(n.current=i))}),[t])}function S(e){return"string"==typeof e||Array.isArray(e)}function P(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}const T=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],C=["initial",...T];function _(e){return P(e.animate)||C.some((t=>S(e[t])))}function k(e){return Boolean(_(e)||e.variants)}function A(e){return Array.isArray(e)?e.join(" "):e}const V={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},L={};for(const e in V)L[e]={isEnabled:t=>V[e].some((e=>!!t[e]))};var M=n(1741),R=n(5364);const D=Symbol.for("motionComponentSymbol");function I({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:a,Component:l}){e&&function(e){for(const t in e)L[t]={...L[t],...e[t]}}(e);const u=(0,s.forwardRef)((function(e,u){let d;const h={...(0,s.useContext)(r._),...e,layoutId:B(e)},{isStatic:m}=h,p=function(e){const{initial:t,animate:n}=function(e,t){if(_(e)){const{initial:t,animate:n}=e;return{initial:!1===t||S(t)?t:void 0,animate:S(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,s.useContext)(o));return(0,s.useMemo)((()=>({initial:t,animate:n})),[A(t),A(n)])}(e),f=a(e,m);if(!m&&M.j){(0,s.useContext)(c).strict;const e=function(e){const{drag:t,layout:n}=L;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:(null==t?void 0:t.isEnabled(e))||(null==n?void 0:n.isEnabled(e))?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(h);d=e.MeasureLayout,p.visualElement=x(l,f,h,t,e.ProjectionNode)}return(0,i.jsxs)(o.Provider,{value:p,children:[d&&p.visualElement?(0,i.jsx)(d,{visualElement:p.visualElement,...h}):null,n(l,e,E(f,p.visualElement,u),f,m,p.visualElement)]})}));return u[D]=l,u}function B({layoutId:e}){const t=(0,s.useContext)(R.p).id;return t&&void 0!==e?t+"-"+e:e}function j(e){function t(t,n={}){return I(e(t,n))}if("undefined"==typeof Proxy)return t;const n=new Map;return new Proxy(t,{get:(e,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const N=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function O(e){return"string"==typeof e&&!e.includes("-")&&!!(N.indexOf(e)>-1||/[A-Z]/u.test(e))}const F={},H=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Z=new Set(H);function U(e,{layout:t,layoutId:n}){return Z.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!F[e]||"opacity"===e)}const z=e=>Boolean(e&&e.getVelocity),$=(e,t)=>t&&"number"==typeof e?t.transform(e):e,G=(e,t,n)=>n>t?t:n"number"==typeof e,parse:parseFloat,transform:e=>e},K={...W,transform:e=>G(0,1,e)},q={...W,default:1},Y=e=>Math.round(1e5*e)/1e5,X=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,J=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Q=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function ee(e){return"string"==typeof e}const te=e=>({test:t=>ee(t)&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),ne=te("deg"),ie=te("%"),se=te("px"),re=te("vh"),oe=te("vw"),ae={...ie,parse:e=>ie.parse(e)/100,transform:e=>ie.transform(100*e)},le={...W,transform:Math.round},ce={borderWidth:se,borderTopWidth:se,borderRightWidth:se,borderBottomWidth:se,borderLeftWidth:se,borderRadius:se,radius:se,borderTopLeftRadius:se,borderTopRightRadius:se,borderBottomRightRadius:se,borderBottomLeftRadius:se,width:se,maxWidth:se,height:se,maxHeight:se,size:se,top:se,right:se,bottom:se,left:se,padding:se,paddingTop:se,paddingRight:se,paddingBottom:se,paddingLeft:se,margin:se,marginTop:se,marginRight:se,marginBottom:se,marginLeft:se,rotate:ne,rotateX:ne,rotateY:ne,rotateZ:ne,scale:q,scaleX:q,scaleY:q,scaleZ:q,skew:ne,skewX:ne,skewY:ne,distance:se,translateX:se,translateY:se,translateZ:se,x:se,y:se,z:se,perspective:se,transformPerspective:se,opacity:K,originX:ae,originY:ae,originZ:se,zIndex:le,backgroundPositionX:se,backgroundPositionY:se,fillOpacity:K,strokeOpacity:K,numOctaves:le},ue={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},de=H.length,he=e=>t=>"string"==typeof t&&t.startsWith(e),me=he("--"),pe=he("var(--"),fe=e=>!!pe(e)&&ge.test(e.split("/*")[0].trim()),ge=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ve(e,t,n){const{style:i,vars:s,transformOrigin:r}=e;let o=!1,a=!1;for(const e in t){const n=t[e];if(Z.has(e))o=!0;else if(me(e))s[e]=n;else{const t=$(n,ce[e]);e.startsWith("origin")?(a=!0,r[e]=t):i[e]=t}}if(t.transform||(o||n?i.transform=function(e,t,n){let i="",s=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}});function xe(e,t,n){for(const i in t)z(t[i])||U(i,n)||(e[i]=t[i])}function we(e,t){const n={},i=function(e,t){const n={};return xe(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return(0,s.useMemo)((()=>{const n=ye();return ve(n,t,e),Object.assign({},n.vars,n.style)}),[t])}(e,t)),n}(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const be=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ee(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||be.has(e)}let Se=e=>!Ee(e);try{(Pe=require("@emotion/is-prop-valid").default)&&(Se=e=>e.startsWith("on")?!Ee(e):Pe(e))}catch(e){}var Pe;function Te(e,t,n){return"string"==typeof e?e:se.transform(t+n*e)}const Ce={offset:"stroke-dashoffset",array:"stroke-dasharray"},_e={offset:"strokeDashoffset",array:"strokeDasharray"};function ke(e,{attrX:t,attrY:n,attrScale:i,originX:s,originY:r,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,d){if(ve(e,c,d),u)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:h,style:m,dimensions:p}=e;h.transform&&(p&&(m.transform=h.transform),delete h.transform),p&&(void 0!==s||void 0!==r||m.transform)&&(m.transformOrigin=function(e,t,n){return`${Te(t,e.x,e.width)} ${Te(n,e.y,e.height)}`}(p,void 0!==s?s:.5,void 0!==r?r:.5)),void 0!==t&&(h.x=t),void 0!==n&&(h.y=n),void 0!==i&&(h.scale=i),void 0!==o&&function(e,t,n=1,i=0,s=!0){e.pathLength=1;const r=s?Ce:_e;e[r.offset]=se.transform(-i);const o=se.transform(t),a=se.transform(n);e[r.array]=`${o} ${a}`}(h,o,a,l,!1)}const Ae=()=>({...ye(),attrs:{}}),Ve=e=>"string"==typeof e&&"svg"===e.toLowerCase();function Le(e,t,n,i){const r=(0,s.useMemo)((()=>{const n=Ae();return ke(n,t,Ve(i),e.transformTemplate),{...n.attrs,style:{...n.style}}}),[t]);if(e.style){const t={};xe(t,e.style,e),r.style={...t,...r.style}}return r}function Me(e=!1){return(t,n,i,{latestValues:r},o)=>{const a=(O(t)?Le:we)(n,r,o,t),l=function(e,t,n){const i={};for(const s in e)"values"===s&&"object"==typeof e.values||(Se(s)||!0===n&&Ee(s)||!t&&!Ee(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}(n,"string"==typeof t,e),c=t!==s.Fragment?{...l,...a,ref:i}:{},{children:u}=n,d=(0,s.useMemo)((()=>z(u)?u.get():u),[u]);return(0,s.createElement)(t,{...c,children:d})}}function Re(e,{style:t,vars:n},i,s){Object.assign(e.style,t,s&&s.getProjectionStyles(i));for(const t in n)e.style.setProperty(t,n[t])}const De=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Ie(e,t,n,i){Re(e,t,void 0,i);for(const n in t.attrs)e.setAttribute(De.has(n)?n:u(n),t.attrs[n])}function Be(e,t,n){var i;const{style:s}=e,r={};for(const o in s)(z(s[o])||t.style&&z(t.style[o])||U(o,e)||void 0!==(null===(i=null==n?void 0:n.getValue(o))||void 0===i?void 0:i.liveStyle))&&(r[o]=s[o]);return n&&s&&"string"==typeof s.willChange&&(n.applyWillChange=!1),r}function je(e,t,n){const i=Be(e,t,n);for(const n in e)(z(e[n])||z(t[n]))&&(i[-1!==H.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]);return i}function Ne(e){const t=[{},{}];return null==e||e.values.forEach(((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()})),t}function Oe(e,t,n,i){if("function"==typeof t){const[s,r]=Ne(i);t=t(void 0!==n?n:e.custom,s,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[s,r]=Ne(i);t=t(void 0!==n?n:e.custom,s,r)}return t}var Fe=n(6681);const He=e=>Array.isArray(e),Ze=e=>Boolean(e&&"object"==typeof e&&e.mix&&e.toValue),Ue=e=>He(e)?e[e.length-1]||0:e;function ze(e){const t=z(e)?e.get():e;return Ze(t)?t.toValue():t}const $e=new Set(["opacity","clipPath","filter","transform"]);function Ge(e){return Z.has(e)?"transform":$e.has(e)?u(e):void 0}function We(e,t){-1===e.indexOf(t)&&e.push(t)}function Ke(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const qe=e=>(t,n)=>{const i=(0,s.useContext)(o),r=(0,s.useContext)(a.O),l=()=>function({applyWillChange:e=!1,scrapeMotionValuesFromProps:t,createRenderState:n,onMount:i},s,r,o,a){const l={latestValues:Je(s,r,o,!a&&e,t),renderState:n()};return i&&(l.mount=e=>i(s,e,l)),l}(e,t,i,r,n);return n?l():(0,Fe.h)(l)};function Ye(e,t){const n=Ge(t);n&&We(e,n)}function Xe(e,t,n){const i=Array.isArray(t)?t:[t];for(let t=0;t{for(const t in e){let n=e[t];Array.isArray(n)&&(n=n[p?n.length-1:0]),null!==n&&(o[t]=n)}for(const e in t)o[e]=t[e]})),l&&(d&&!1!==u&&!P(d)&&Xe(e,d,(e=>{for(const t in e)Ye(a,t)})),a.length&&(o.willChange=a.join(","))),o}var Qe=n(1662);const{schedule:et,cancel:tt,state:nt,steps:it}=m("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Qe.Z,!0),st={useVisualState:qe({scrapeMotionValuesFromProps:je,createRenderState:Ae,onMount:(e,t,{renderState:n,latestValues:i})=>{et.read((()=>{try{n.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch(e){n.dimensions={x:0,y:0,width:0,height:0}}})),et.render((()=>{ke(n,i,Ve(t.tagName),e.transformTemplate),Ie(t,n)}))}})},rt={useVisualState:qe({applyWillChange:!0,scrapeMotionValuesFromProps:Be,createRenderState:ye})};function ot(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}const at=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function lt(e,t="page"){return{point:{x:e[`${t}X`],y:e[`${t}Y`]}}}const ct=e=>t=>at(t)&&e(t,lt(t));function ut(e,t,n,i){return ot(e,t,ct(n),i)}const dt=(e,t)=>n=>t(e(n)),ht=(...e)=>e.reduce(dt);function mt(e){let t=null;return()=>null===t&&(t=e,()=>{t=null})}const pt=mt("dragHorizontal"),ft=mt("dragVertical");function gt(e){let t=!1;if("y"===e)t=ft();else if("x"===e)t=pt();else{const e=pt(),n=ft();e&&n?t=()=>{e(),n()}:(e&&e(),n&&n())}return t}function vt(){const e=gt(!0);return!e||(e(),!1)}class yt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function xt(e,t){const n=t?"pointerenter":"pointerleave",i=t?"onHoverStart":"onHoverEnd";return ut(e.current,n,((n,s)=>{if("touch"===n.pointerType||vt())return;const r=e.getProps();e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",t);const o=r[i];o&&et.postRender((()=>o(n,s)))}),{passive:!e.getProps()[i]})}const wt=(e,t)=>!!t&&(e===t||wt(e,t.parentElement));function bt(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,lt(n))}const Et=new WeakMap,St=new WeakMap,Pt=e=>{const t=Et.get(e.target);t&&t(e)},Tt=e=>{e.forEach(Pt)};const Ct={some:0,all:1},_t={inView:{Feature:class extends yt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:i="some",once:s}=e,r={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof i?i:Ct[i]};return function(e,t,n){const i=function({root:e,...t}){const n=e||document;St.has(n)||St.set(n,{});const i=St.get(n),s=JSON.stringify(t);return i[s]||(i[s]=new IntersectionObserver(Tt,{root:e,...t})),i[s]}(t);return Et.set(e,n),i.observe(e),()=>{Et.delete(e),i.unobserve(e)}}(this.node.current,r,(e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,s&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:i}=this.node.getProps(),r=t?n:i;r&&r(e)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends yt{constructor(){super(...arguments),this.removeStartListeners=Qe.Z,this.removeEndListeners=Qe.Z,this.removeAccessibleListeners=Qe.Z,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),i=ut(window,"pointerup",((e,t)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:i,globalTapTarget:s}=this.node.getProps(),r=s||wt(this.node.current,e.target)?n:i;r&&et.update((()=>r(e,t)))}),{passive:!(n.onTap||n.onPointerUp)}),s=ut(window,"pointercancel",((e,t)=>this.cancelPress(e,t)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=ht(i,s),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=ot(this.node.current,"keydown",(e=>{"Enter"!==e.key||this.isPressing||(this.removeEndListeners(),this.removeEndListeners=ot(this.node.current,"keyup",(e=>{"Enter"===e.key&&this.checkPressEnd()&&bt("up",((e,t)=>{const{onTap:n}=this.node.getProps();n&&et.postRender((()=>n(e,t)))}))})),bt("down",((e,t)=>{this.startPress(e,t)})))})),t=ot(this.node.current,"blur",(()=>{this.isPressing&&bt("cancel",((e,t)=>this.cancelPress(e,t)))}));this.removeAccessibleListeners=ht(e,t)}}startPress(e,t){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&et.postRender((()=>n(e,t)))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!vt()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&et.postRender((()=>n(e,t)))}mount(){const e=this.node.getProps(),t=ut(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=ot(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=ht(t,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends yt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ht(ot(this.node.current,"focus",(()=>this.onFocus())),ot(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends yt{mount(){this.unmount=ht(xt(this.node,!0),xt(this.node,!1))}unmount(){}}}};function kt(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i1e3*e,Lt=e=>e/1e3,Mt={type:"spring",stiffness:500,damping:25,restSpeed:10},Rt={type:"keyframes",duration:.8},Dt={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},It=(e,{keyframes:t})=>t.length>2?Rt:Z.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:Mt:Dt;function Bt(e,t){return e[t]||e.default||e}const jt=e=>null!==e;function Nt(e,{repeat:t,repeatType:n="loop"},i){const s=e.filter(jt),r=t&&"loop"!==n&&t%2==1?0:s.length-1;return r&&void 0!==i?i:s[r]}let Ot;function Ft(){Ot=void 0}const Ht={now:()=>(void 0===Ot&&Ht.set(nt.isProcessing?nt.timestamp:performance.now()),Ot),set:e=>{Ot=e,queueMicrotask(Ft)}},Zt=e=>/^0[^.\s]+$/u.test(e);var Ut=n(5487);const zt=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),$t=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Gt(e,t,n=1){(0,Ut.k)(n<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);const[i,s]=function(e){const t=$t.exec(e);if(!t)return[,];const[,n,i,s]=t;return[`--${null!=n?n:i}`,s]}(e);if(!i)return;const r=window.getComputedStyle(t).getPropertyValue(i);if(r){const e=r.trim();return zt(e)?parseFloat(e):e}return fe(s)?Gt(s,t,n+1):s}const Wt=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Kt=e=>e===W||e===se,qt=(e,t)=>parseFloat(e.split(", ")[t]),Yt=(e,t)=>(n,{transform:i})=>{if("none"===i||!i)return 0;const s=i.match(/^matrix3d\((.+)\)$/u);if(s)return qt(s[1],t);{const t=i.match(/^matrix\((.+)\)$/u);return t?qt(t[1],e):0}},Xt=new Set(["x","y","z"]),Jt=H.filter((e=>!Xt.has(e))),Qt={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Yt(4,13),y:Yt(5,14)};Qt.translateX=Qt.x,Qt.translateY=Qt.y;const en=e=>t=>t.test(e),tn=[W,se,ie,ne,oe,re,{test:e=>"auto"===e,parse:e=>e}],nn=e=>tn.find(en(e)),sn=new Set;let rn=!1,on=!1;function an(){if(on){const e=Array.from(sn).filter((e=>e.needsMeasurement)),t=new Set(e.map((e=>e.element))),n=new Map;t.forEach((e=>{const t=function(e){const t=[];return Jt.forEach((n=>{const i=e.getValue(n);void 0!==i&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))})),t}(e);t.length&&(n.set(e,t),e.render())})),e.forEach((e=>e.measureInitialState())),t.forEach((e=>{e.render();const t=n.get(e);t&&t.forEach((([t,n])=>{var i;null===(i=e.getValue(t))||void 0===i||i.set(n)}))})),e.forEach((e=>e.measureEndState())),e.forEach((e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)}))}on=!1,rn=!1,sn.forEach((e=>e.complete())),sn.clear()}function ln(){sn.forEach((e=>{e.readKeyframes(),e.needsMeasurement&&(on=!0)}))}class cn{constructor(e,t,n,i,s,r=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=i,this.element=s,this.isAsync=r}scheduleResolve(){this.isScheduled=!0,this.isAsync?(sn.add(this),rn||(rn=!0,et.read(ln),et.resolveKeyframes(an))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:i}=this;for(let s=0;sn=>Boolean(ee(n)&&Q.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),dn=(e,t,n)=>i=>{if(!ee(i))return i;const[s,r,o,a]=i.match(X);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},hn={...W,transform:e=>Math.round((e=>G(0,255,e))(e))},mn={test:un("rgb","red"),parse:dn("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+hn.transform(e)+", "+hn.transform(t)+", "+hn.transform(n)+", "+Y(K.transform(i))+")"},pn={test:un("#"),parse:function(e){let t="",n="",i="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}},transform:mn.transform},fn={test:un("hsl","hue"),parse:dn("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+ie.transform(Y(t))+", "+ie.transform(Y(n))+", "+Y(K.transform(i))+")"},gn={test:e=>mn.test(e)||pn.test(e)||fn.test(e),parse:e=>mn.test(e)?mn.parse(e):fn.test(e)?fn.parse(e):pn.parse(e),transform:e=>ee(e)?e:e.hasOwnProperty("red")?mn.transform(e):fn.transform(e)},vn="number",yn="color",xn="var",wn="var(",bn="${}",En=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sn(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const o=t.replace(En,(e=>(gn.test(e)?(i.color.push(r),s.push(yn),n.push(gn.parse(e))):e.startsWith(wn)?(i.var.push(r),s.push(xn),n.push(e)):(i.number.push(r),s.push(vn),n.push(parseFloat(e))),++r,bn))).split(bn);return{values:n,split:o,indexes:i,types:s}}function Pn(e){return Sn(e).values}function Tn(e){const{split:t,types:n}=Sn(e),i=t.length;return e=>{let s="";for(let r=0;r"number"==typeof e?0:e,kn={test:function(e){var t,n;return isNaN(e)&&ee(e)&&((null===(t=e.match(X))||void 0===t?void 0:t.length)||0)+((null===(n=e.match(J))||void 0===n?void 0:n.length)||0)>0},parse:Pn,createTransformer:Tn,getAnimatableNone:function(e){const t=Pn(e);return Tn(e)(t.map(Cn))}},An=new Set(["brightness","contrast","saturate","opacity"]);function Vn(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[i]=n.match(X)||[];if(!i)return e;const s=n.replace(i,"");let r=An.has(t)?1:0;return i!==n&&(r*=100),t+"("+r+s+")"}const Ln=/\b([a-z-]*)\(.*?\)/gu,Mn={...kn,getAnimatableNone:e=>{const t=e.match(Ln);return t?t.map(Vn).join(" "):e}},Rn={...ce,color:gn,backgroundColor:gn,outlineColor:gn,fill:gn,stroke:gn,borderColor:gn,borderTopColor:gn,borderRightColor:gn,borderBottomColor:gn,borderLeftColor:gn,filter:Mn,WebkitFilter:Mn},Dn=e=>Rn[e];function In(e,t){let n=Dn(e);return n!==Mn&&(n=kn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Bn=new Set(["auto","none","0"]);class jn extends cn{constructor(e,t,n,i){super(e,t,n,i,null==i?void 0:i.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t.current)return;super.readKeyframes();for(let n=0;n{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}function Nn(e){let t;return()=>(void 0===t&&(t=e()),t)}const On=(e,t)=>!("zIndex"===t||"number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!kn.test(e)&&"0"!==e||e.startsWith("url(")));class Fn{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:t,type:n,repeat:i,repeatDelay:s,repeatType:r,...o},this.updateFinishedPromise()}get resolved(){return this._resolved||this.hasAttemptedResolve||(ln(),an()),this._resolved}onKeyframesResolved(e,t){this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:r,onComplete:o,onUpdate:a,isGenerator:l}=this.options;if(!l&&!function(e,t,n,i){const s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;const r=e[e.length-1],o=On(s,t),a=On(r,t);return(0,Ut.K)(o===a,`You are trying to animate ${t} from "${s}" to "${r}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${r} via the \`style\` property.`),!(!o||!a)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n{this.resolveFinishedPromise=e}))}}function Hn(e,t){return t?e*(1e3/t):0}const Zn=5;function Un(e,t,n){const i=Math.max(t-Zn,0);return Hn(n-e(i),t-i)}const zn=.001,$n=.01,Gn=10,Wn=.05,Kn=1;const qn=12;function Yn(e,t){return e*Math.sqrt(1-t*t)}const Xn=["duration","bounce"],Jn=["stiffness","damping","mass"];function Qn(e,t){return t.some((t=>void 0!==e[t]))}function ei({keyframes:e,restDelta:t,restSpeed:n,...i}){const s=e[0],r=e[e.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:u,velocity:d,isResolvedFromDuration:h}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Qn(e,Jn)&&Qn(e,Xn)){const n=function({duration:e=800,bounce:t=.25,velocity:n=0,mass:i=1}){let s,r;(0,Ut.K)(e<=Vt(Gn),"Spring duration must be 10 seconds or less");let o=1-t;o=G(Wn,Kn,o),e=G($n,Gn,Lt(e)),o<1?(s=t=>{const i=t*o,s=i*e,r=i-n,a=Yn(t,o),l=Math.exp(-s);return zn-r/a*l},r=t=>{const i=t*o*e,r=i*n+n,a=Math.pow(o,2)*Math.pow(t,2)*e,l=Math.exp(-i),c=Yn(Math.pow(t,2),o);return(-s(t)+zn>0?-1:1)*((r-a)*l)/c}):(s=t=>Math.exp(-t*e)*((t-n)*e+1)-zn,r=t=>Math.exp(-t*e)*(e*e*(n-t)));const a=function(e,t,n){let i=n;for(let n=1;n{const n=Math.exp(-p*g*t);return r-n*((m+p*g*f)/e*Math.sin(e*t)+f*Math.cos(e*t))}}else if(1===p)y=e=>r-Math.exp(-g*e)*(f+(m+g*f)*e);else{const e=g*Math.sqrt(p*p-1);y=t=>{const n=Math.exp(-p*g*t),i=Math.min(e*t,300);return r-n*((m+p*g*f)*Math.sinh(i)+e*f*Math.cosh(i))/e}}return{calculatedDuration:h&&u||null,next:e=>{const i=y(e);if(h)o.done=e>=u;else{let s=m;0!==e&&(s=p<1?Un(y,e,i):0);const a=Math.abs(s)<=n,l=Math.abs(r-i)<=t;o.done=a&&l}return o.value=o.done?r:i,o}}}function ti({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},m=e=>void 0===a?l:void 0===l||Math.abs(a-e)-p*Math.exp(-e/i),y=e=>g+v(e),x=e=>{const t=v(e),n=y(e);h.done=Math.abs(t)<=c,h.value=h.done?g:n};let w,b;const E=e=>{var t;t=h.value,(void 0!==a&&tl)&&(w=e,b=ei({keyframes:[h.value,m(h.value)],velocity:Un(y,e,h.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:e=>{let t=!1;return b||void 0!==w||(t=!0,x(e),E(e)),void 0!==w&&e>=w?b.next(e-w):(!t&&x(e),h)}}}const ni=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function ii(e,t,n,i){if(e===t&&n===i)return Qe.Z;return s=>0===s||1===s?s:ni(function(e,t,n,i,s){let r,o,a=0;do{o=t+(n-t)/2,r=ni(o,i,s)-e,r>0?n=o:t=o}while(Math.abs(r)>1e-7&&++a<12);return o}(s,0,1,e,n),t,i)}const si=ii(.42,0,1,1),ri=ii(0,0,.58,1),oi=ii(.42,0,.58,1),ai=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,li=e=>t=>1-e(1-t),ci=e=>1-Math.sin(Math.acos(e)),ui=li(ci),di=ai(ci),hi=ii(.33,1.53,.69,.99),mi=li(hi),pi=ai(mi),fi={linear:Qe.Z,easeIn:si,easeInOut:oi,easeOut:ri,circIn:ci,circInOut:di,circOut:ui,backIn:mi,backInOut:pi,backOut:hi,anticipate:e=>(e*=2)<1?.5*mi(e):.5*(2-Math.pow(2,-10*(e-1)))},gi=e=>{if(Array.isArray(e)){(0,Ut.k)(4===e.length,"Cubic bezier arrays must contain four numerical values.");const[t,n,i,s]=e;return ii(t,n,i,s)}return"string"==typeof e?((0,Ut.k)(void 0!==fi[e],`Invalid easing type '${e}'`),fi[e]):e},vi=(e,t,n)=>{const i=t-e;return 0===i?1:(n-e)/i},yi=(e,t,n)=>e+(t-e)*n;function xi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function wi(e,t){return n=>n>0?t:e}const bi=(e,t,n)=>{const i=e*e,s=n*(t*t-i)+i;return s<0?0:Math.sqrt(s)},Ei=[pn,mn,fn];function Si(e){const t=(n=e,Ei.find((e=>e.test(n))));var n;if((0,Ut.K)(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(t))return!1;let i=t.parse(e);return t===fn&&(i=function({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,n/=100;let s=0,r=0,o=0;if(t/=100){const i=n<.5?n*(1+t):n+t-n*t,a=2*n-i;s=xi(a,i,e+1/3),r=xi(a,i,e),o=xi(a,i,e-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:i}}(i)),i}const Pi=(e,t)=>{const n=Si(e),i=Si(t);if(!n||!i)return wi(e,t);const s={...n};return e=>(s.red=bi(n.red,i.red,e),s.green=bi(n.green,i.green,e),s.blue=bi(n.blue,i.blue,e),s.alpha=yi(n.alpha,i.alpha,e),mn.transform(s))},Ti=new Set(["none","hidden"]);function Ci(e,t){return n=>yi(e,t,n)}function _i(e){return"number"==typeof e?Ci:"string"==typeof e?fe(e)?wi:gn.test(e)?Pi:Vi:Array.isArray(e)?ki:"object"==typeof e?gn.test(e)?Pi:Ai:wi}function ki(e,t){const n=[...e],i=n.length,s=e.map(((e,n)=>_i(e)(e,t[n])));return e=>{for(let t=0;t{for(const t in i)n[t]=i[t](e);return n}}const Vi=(e,t)=>{const n=kn.createTransformer(t),i=Sn(e),s=Sn(t);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?Ti.has(e)&&!s.values.length||Ti.has(t)&&!i.values.length?function(e,t){return Ti.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):ht(ki(function(e,t){var n;const i=[],s={color:0,var:0,number:0};for(let r=0;rArray.isArray(e)&&"number"!=typeof e[0])(i)?i.map(gi):gi(i),r={done:!1,value:t[0]},o=function(e,t){return e.map((e=>e*t))}(n&&n.length===t.length?n:function(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const s=vi(0,t,i);e.push(yi(n,1,s))}}(t,e.length-1),t}(t),e),a=function(e,t,{clamp:n=!0,ease:i,mixer:s}={}){const r=e.length;if((0,Ut.k)(r===t.length,"Both input and output ranges must be the same length"),1===r)return()=>t[0];if(2===r&&e[0]===e[1])return()=>t[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=function(e,t,n){const i=[],s=n||Li,r=e.length-1;for(let n=0;n{let n=0;if(a>1)for(;nl(G(e[0],e[r-1],t)):l}(o,t,{ease:Array.isArray(s)?s:(l=t,c=s,l.map((()=>c||oi)).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(r.value=a(t),r.done=t>=e,r)}}const Ri=e=>{const t=({timestamp:t})=>e(t);return{start:()=>et.update(t,!0),stop:()=>tt(t),now:()=>nt.isProcessing?nt.timestamp:Ht.now()}},Di={decay:ti,inertia:ti,tween:Mi,keyframes:Mi,spring:ei},Ii=e=>e/100;class Bi extends Fn{constructor({KeyframeResolver:e=cn,...t}){super(t),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:e}=this.options;e&&e()};const{name:n,motionValue:i,keyframes:s}=this.options,r=(e,t)=>this.onKeyframesResolved(e,t);n&&i&&i.owner?this.resolver=i.owner.resolveKeyframes(s,r,n,i):this.resolver=new e(s,r,n,i),this.resolver.scheduleResolve()}initPlayback(e){const{type:t="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:r=0}=this.options,o=Di[t]||Mi;let a,l;o!==Mi&&"number"!=typeof e[0]&&(a=ht(Ii,Li(e[0],e[1])),e=[0,100]);const c=o({...this.options,keyframes:e});"mirror"===s&&(l=o({...this.options,keyframes:[...e].reverse(),velocity:-r})),null===c.calculatedDuration&&(c.calculatedDuration=function(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}(c));const{calculatedDuration:u}=c,d=u+i;return{generator:c,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:d,totalDuration:d*(n+1)-i}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&e?this.state=this.pendingPlayState:this.pause()}tick(e,t=!1){const{resolved:n}=this;if(!n){const{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:r,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:l,totalDuration:c,resolvedDuration:u}=n;if(null===this.startTime)return s.next(0);const{delay:d,repeat:h,repeatType:m,repeatDelay:p,onUpdate:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),t?this.currentTime=e:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const g=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?g<0:g>c;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let y=this.currentTime,x=s;if(h){const e=Math.min(this.currentTime,c)/u;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,h+1),Boolean(t%2)&&("reverse"===m?(n=1-n,p&&(n-=p/u)):"mirror"===m&&(x=r)),y=G(0,1,n)*u}const w=v?{done:!1,value:a[0]}:x.next(y);o&&(w.value=o(w.value));let{done:b}=w;v||null===l||(b=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const E=null===this.holdTime&&("finished"===this.state||"running"===this.state&&b);return E&&void 0!==i&&(w.value=Nt(a,this.options,i)),f&&f(w.value),E&&this.finish(),w}get duration(){const{resolved:e}=this;return e?Lt(e.calculatedDuration):0}get time(){return Lt(this.currentTime)}set time(e){e=Vt(e),this.currentTime=e,null!==this.holdTime||0===this.speed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Lt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:e=Ri,onPlay:t}=this.options;this.driver||(this.driver=e((e=>this.tick(e)))),t&&t();const n=this.driver.now();null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime&&"finished"!==this.state||(this.startTime=n),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;this._resolved?(this.state="paused",this.holdTime=null!==(e=this.currentTime)&&void 0!==e?e:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const ji=e=>Array.isArray(e)&&"number"==typeof e[0];function Ni(e){return Boolean(!e||"string"==typeof e&&e in Fi||ji(e)||Array.isArray(e)&&e.every(Ni))}const Oi=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,Fi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Oi([0,.65,.55,1]),circOut:Oi([.55,0,1,.45]),backIn:Oi([.31,.01,.66,-.59]),backOut:Oi([.33,1.53,.69,.99])};function Hi(e){return Zi(e)||Fi.easeOut}function Zi(e){return e?ji(e)?Oi(e):Array.isArray(e)?e.map(Hi):Fi[e]:void 0}const Ui=Nn((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class zi extends Fn{constructor(e){super(e);const{name:t,motionValue:n,keyframes:i}=this.options;this.resolver=new jn(i,((e,t)=>this.onKeyframesResolved(e,t)),t,n),this.resolver.scheduleResolve()}initPlayback(e,t){var n;let{duration:i=300,times:s,ease:r,type:o,motionValue:a,name:l}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;if("spring"===(c=this.options).type||!Ni(c.ease)){const{onComplete:t,onUpdate:n,motionValue:a,...l}=this.options,c=function(e,t){const n=new Bi({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const s=[];let r=0;for(;!i.done&&r<2e4;)i=n.sample(r),s.push(i.value),r+=10;return{times:void 0,keyframes:s,duration:r-10,ease:"linear"}}(e,l);1===(e=c.keyframes).length&&(e[1]=e[0]),i=c.duration,s=c.times,r=c.ease,o="keyframes"}var c;const u=function(e,t,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:a,times:l}={}){const c={[t]:n};l&&(c.offset=l);const u=Zi(a);return Array.isArray(u)&&(c.easing=u),e.animate(c,{delay:i,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"})}(a.owner.current,l,e,{...this.options,duration:i,times:s,ease:r});return u.startTime=Ht.now(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:n}=this.options;a.set(Nt(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:s,type:o,ease:r,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return Lt(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return Lt(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.currentTime=Vt(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}attachTimeline(e){if(this._resolved){const{resolved:t}=this;if(!t)return Qe.Z;const{animation:n}=t;n.timeline=e,n.onfinish=null}else this.pendingTimeline=e;return Qe.Z}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;"finished"===t.playState&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:n,duration:i,type:s,ease:r,times:o}=e;if("idle"===t.playState||"finished"===t.playState)return;if(this.time){const{motionValue:e,onUpdate:t,onComplete:a,...l}=this.options,c=new Bi({...l,keyframes:n,duration:i,type:s,ease:r,times:o,isGenerator:!0}),u=Vt(this.time);e.setWithVelocity(c.sample(u-10).value,c.sample(u).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:n,repeatDelay:i,repeatType:s,damping:r,type:o}=e;return Ui()&&n&&$e.has(n)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!i&&"mirror"!==s&&0!==r&&"inertia"!==o}}const $i=Nn((()=>void 0!==window.ScrollTimeline));class Gi{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n{if(!$i()||!t.attachTimeline)return t.pause(),function(e,n){let i;const s=()=>{const{currentTime:e}=n,s=(null===e?0:e.value)/100;i!==s&&(e=>{t.time=t.duration*e})(s),i=s};return et.update(s,!0),()=>tt(s)}(0,e);t.attachTimeline(e)}));return()=>{t.forEach(((e,t)=>{e&&e(),this.animations[t].stop()}))}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let t=0;tt[e]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Wi=(e,t,n,i={},s,r,o)=>a=>{const l=Bt(i,e)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u-=Vt(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:e=>{t.set(e),l.onUpdate&&l.onUpdate(e)},onComplete:()=>{a(),l.onComplete&&l.onComplete(),o&&o()},onStop:o,name:e,motionValue:t,element:r?void 0:s};(function({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length})(l)||(d={...d,...It(e,d)}),d.duration&&(d.duration=Vt(d.duration)),d.repeatDelay&&(d.repeatDelay=Vt(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let h=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(d.duration=0,0===d.delay&&(h=!0)),h&&!r&&void 0!==t.get()){const e=Nt(d.keyframes,l);if(void 0!==e)return et.update((()=>{d.onUpdate(e),d.onComplete()})),new Gi([])}return!r&&zi.supports(d)?new zi(d):new Bi(d)};class Ki{constructor(){this.subscriptions=[]}add(e){return We(this.subscriptions,e),()=>Ke(this.subscriptions,e)}notify(e,t,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](e,t,n);else for(let s=0;s{const n=Ht.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=Ht.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ki);const n=this.events[e].add(t);return"change"===e?()=>{n(),et.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return qi.current&&qi.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Ht.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Hn(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise((t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xi(e,t){return new Yi(e,t)}function Ji(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Xi(n))}function Qi(e){return e.getProps()[d]}class es extends Yi{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(e){const t=Ge(e);if(!t)return;const n=this.counts.get(t)||0;this.counts.set(t,n+1),0===n&&(this.output.push(t),this.update());let i=!1;return()=>{if(i)return;i=!0;const e=this.counts.get(t)-1;this.counts.set(t,e),0===e&&(Ke(this.output,t),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}function ts(e,t){var n;if(!e.applyWillChange)return;let i=e.getValue("willChange");return i||(null===(n=e.props.style)||void 0===n?void 0:n.willChange)||(i=new es("auto"),e.addValue("willChange",i)),s=i,Boolean(z(s)&&s.add)?i.add(t):void 0;var s}function ns({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,i}function is(e,t,{delay:n=0,transitionOverride:i,type:s}={}){var r;let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;i&&(o=i);const c=[],u=s&&e.animationState&&e.animationState.getState()[s];for(const t in l){const i=e.getValue(t,null!==(r=e.latestValues[t])&&void 0!==r?r:null),s=l[t];if(void 0===s||u&&ns(u,t))continue;const a={delay:n,elapsed:0,...Bt(o||{},t)};let d=!1;if(window.HandoffAppearAnimations){const n=Qi(e);if(n){const e=window.HandoffAppearAnimations(n,t,i,et);null!==e&&(a.elapsed=e,d=!0)}}i.start(Wi(t,i,s,e.shouldReduceMotion&&Z.has(t)?{type:!1}:a,e,d,ts(e,t)));const h=i.animation;h&&c.push(h)}return a&&Promise.all(c).then((()=>{et.update((()=>{a&&function(e,t){const n=At(e,t);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const t in r)Ji(e,t,Ue(r[t]))}(e,a)}))})),c}function ss(e,t,n={}){var i;const s=At(e,t,"exit"===n.type?null===(i=e.presenceContext)||void 0===i?void 0:i.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(is(e,s,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(i=0)=>{const{delayChildren:s=0,staggerChildren:o,staggerDirection:a}=r;return function(e,t,n=0,i=0,s=1,r){const o=[],a=(e.variantChildren.size-1)*i,l=1===s?(e=0)=>e*i:(e=0)=>a-e*i;return Array.from(e.variantChildren).sort(rs).forEach(((e,i)=>{e.notify("AnimationStart",t),o.push(ss(e,t,{...r,delay:n+l(i)}).then((()=>e.notify("AnimationComplete",t))))})),Promise.all(o)}(e,t,s+i,o,a,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[e,t]="beforeChildren"===l?[o,a]:[a,o];return e().then((()=>t()))}return Promise.all([o(),a(n.delay)])}function rs(e,t){return e.sortNodePosition(t)}const os=[...T].reverse(),as=T.length;function ls(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cs(){return{animate:ls(!0),whileInView:ls(),whileHover:ls(),whileTap:ls(),whileDrag:ls(),whileFocus:ls(),exit:ls()}}let us=0;const ds={animation:{Feature:class extends yt{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=function(e){return t=>Promise.all(t.map((({animation:t,options:n})=>function(e,t,n={}){let i;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map((t=>ss(e,t,n)));i=Promise.all(s)}else if("string"==typeof t)i=ss(e,t,n);else{const s="function"==typeof t?At(e,t,n.custom):t;i=Promise.all(is(e,s,n))}return i.then((()=>{e.notify("AnimationComplete",t)}))}(e,t,n))))}(e),n=cs(),i=!0;const s=t=>(n,i)=>{var s;const r=At(e,i,"exit"===t?null===(s=e.presenceContext)||void 0===s?void 0:s.custom:void 0);if(r){const{transition:e,transitionEnd:t,...i}=r;n={...n,...i,...t}}return n};function r(r){const o=e.getProps(),a=e.getVariantContext(!0)||{},l=[],c=new Set;let u={},d=1/0;for(let t=0;td&&v),b=!1;const E=Array.isArray(g)?g:[g];let T=E.reduce(s(p),{});!1===y&&(T={});const{prevResolvedValues:C={}}=f,_={...C,...T},k=t=>{w=!0,c.has(t)&&(b=!0,c.delete(t)),f.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in _){const t=T[e],n=C[e];if(u.hasOwnProperty(e))continue;let i=!1;i=He(t)&&He(n)?!kt(t,n):t!==n,i?null!=t?k(e):c.add(e):void 0!==t&&c.has(e)?k(e):f.protectedKeys[e]=!0}f.prevProp=g,f.prevResolvedValues=T,f.isActive&&(u={...u,...T}),i&&e.blockInitialAnimation&&(w=!1),!w||x&&!b||l.push(...E.map((e=>({animation:e,options:{type:p}}))))}var h,m;if(c.size){const t={};c.forEach((n=>{const i=e.getBaseTarget(n),s=e.getValue(n);s&&(s.liveStyle=!0),t[n]=null!=i?i:null})),l.push({animation:t})}let p=Boolean(l.length);return!i||!1!==o.initial&&o.initial!==o.animate||e.manuallyAnimateOnMount||(p=!1),i=!1,p?t(l):Promise.resolve()}return{animateChanges:r,setActive:function(t,i){var s;if(n[t].isActive===i)return Promise.resolve();null===(s=e.variantChildren)||void 0===s||s.forEach((e=>{var n;return null===(n=e.animationState)||void 0===n?void 0:n.setActive(t,i)})),n[t].isActive=i;const o=r(t);for(const e in n)n[e].protectedKeys={};return o},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=cs(),i=!0}}}(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();P(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null===(e=this.unmountControls)||void 0===e||e.call(this)}}},exit:{Feature:class extends yt{constructor(){super(...arguments),this.id=us++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);t&&!e&&i.then((()=>t(this.id)))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},hs=(e,t)=>Math.abs(e-t);class ms{constructor(e,t,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=gs(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=hs(e.x,t.x),i=hs(e.y,t.y);return Math.sqrt(n**2+i**2)}(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;const{point:i}=e,{timestamp:s}=nt;this.history.push({...i,timestamp:s});const{onStart:r,onMove:o}=this.handlers;t||(r&&r(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=ps(t,this.transformPagePoint),et.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:i,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const r=gs("pointercancel"===e.type?this.lastMoveEventInfo:ps(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,r),i&&i(e,r)},!at(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.contextWindow=i||window;const r=ps(lt(e),this.transformPagePoint),{point:o}=r,{timestamp:a}=nt;this.history=[{...o,timestamp:a}];const{onSessionStart:l}=t;l&&l(e,gs(r,this.history)),this.removeListeners=ht(ut(this.contextWindow,"pointermove",this.handlePointerMove),ut(this.contextWindow,"pointerup",this.handlePointerUp),ut(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),tt(this.updatePoint)}}function ps(e,t){return t?{point:t(e.point)}:e}function fs(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gs({point:e},t){return{point:e,delta:fs(e,ys(t)),offset:fs(e,vs(t)),velocity:xs(t,.1)}}function vs(e){return e[0]}function ys(e){return e[e.length-1]}function xs(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const s=ys(e);for(;n>=0&&(i=e[n],!(s.timestamp-i.timestamp>Vt(t)));)n--;if(!i)return{x:0,y:0};const r=Lt(s.timestamp-i.timestamp);if(0===r)return{x:0,y:0};const o={x:(s.x-i.x)/r,y:(s.y-i.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const ws=.9999,bs=1.0001,Es=-.01,Ss=.01;function Ps(e){return e.max-e.min}function Ts(e,t,n,i=.5){e.origin=i,e.originPoint=yi(t.min,t.max,e.origin),e.scale=Ps(n)/Ps(t),e.translate=yi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ws&&e.scale<=bs||isNaN(e.scale))&&(e.scale=1),(e.translate>=Es&&e.translate<=Ss||isNaN(e.translate))&&(e.translate=0)}function Cs(e,t,n,i){Ts(e.x,t.x,n.x,i?i.originX:void 0),Ts(e.y,t.y,n.y,i?i.originY:void 0)}function _s(e,t,n){e.min=n.min+t.min,e.max=e.min+Ps(t)}function ks(e,t,n){e.min=t.min-n.min,e.max=e.min+Ps(t)}function As(e,t,n){ks(e.x,t.x,n.x),ks(e.y,t.y,n.y)}function Vs(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function Ls(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),Bs=()=>({x:{min:0,max:0},y:{min:0,max:0}});function js(e){return[e("x"),e("y")]}function Ns({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function Os(e){return void 0===e||1===e}function Fs({scale:e,scaleX:t,scaleY:n}){return!Os(e)||!Os(t)||!Os(n)}function Hs(e){return Fs(e)||Zs(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Zs(e){return Us(e.x)||Us(e.y)}function Us(e){return e&&"0%"!==e}function zs(e,t,n){return n+t*(e-n)}function $s(e,t,n,i,s){return void 0!==s&&(e=zs(e,s,i)),zs(e,n,i)+t}function Gs(e,t=0,n=1,i,s){e.min=$s(e.min,t,n,i,s),e.max=$s(e.max,t,n,i,s)}function Ws(e,{x:t,y:n}){Gs(e.x,t.translate,t.scale,t.originPoint),Gs(e.y,n.translate,n.scale,n.originPoint)}const Ks=.999999999999,qs=1.0000000000001;function Ys(e,t){e.min=e.min+t,e.max=e.max+t}function Xs(e,t,n,i,s=.5){Gs(e,t,n,yi(e.min,e.max,s),i)}function Js(e,t){Xs(e.x,t.x,t.scaleX,t.scale,t.originX),Xs(e.y,t.y,t.scaleY,t.scale,t.originY)}function Qs(e,t){return Ns(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(e.getBoundingClientRect(),t))}const er=({current:e})=>e?e.ownerDocument.defaultView:null,tr=new WeakMap;class nr{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Bs(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:i}=this.getProps();this.panSession=new ms(e,{onSessionStart:e=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(lt(e,"page").point)},onStart:(e,t)=>{var n;const{drag:i,dragPropagation:s,onDragStart:r}=this.getProps();if(i&&!s&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=gt(i),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),js((e=>{let t=this.getAxisMotionValue(e).get()||0;if(ie.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const i=n.layout.layoutBox[e];i&&(t=Ps(i)*(parseFloat(t)/100))}}this.originPoint[e]=t})),r&&et.postRender((()=>r(e,t))),null===(n=this.removeWillChange)||void 0===n||n.call(this),this.removeWillChange=ts(this.visualElement,"transform");const{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},onMove:(e,t)=>{const{dragPropagation:n,dragDirectionLock:i,onDirectionLock:s,onDrag:r}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:o}=t;if(i&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(o),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),r&&r(e,t)},onSessionEnd:(e,t)=>this.stop(e,t),resumeAnimation:()=>js((e=>{var t;return"paused"===this.getAnimationState(e)&&(null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:i,contextWindow:er(this.visualElement)})}stop(e,t){var n;null===(n=this.removeWillChange)||void 0===n||n.call(this);const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=t;this.startAnimation(s);const{onDragEnd:r}=this.getProps();r&&et.postRender((()=>r(e,t)))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,n){const{drag:i}=this.getProps();if(!n||!ir(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let r=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:t,max:n},i){return void 0!==t&&en&&(e=i?yi(n,e,i.max):Math.min(e,n)),e}(r,this.constraints[e],this.elastic[e])),s.set(r)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(e=this.visualElement.projection)||void 0===e?void 0:e.layout,s=this.constraints;t&&g(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i)&&function(e,{top:t,left:n,bottom:i,right:s}){return{x:Vs(e.x,n,s),y:Vs(e.y,t,i)}}(i.layoutBox,t),this.elastic=function(e=Ms){return!1===e?e=0:!0===e&&(e=Ms),{x:Rs(e,"left","right"),y:Rs(e,"top","bottom")}}(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&js((e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(i.layoutBox[e],this.constraints[e]))}))}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!g(e))return!1;const n=e.current;(0,Ut.k)(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=function(e,t,n){const i=Qs(e,n),{scroll:s}=t;return s&&(Ys(i.x,s.offset.x),Ys(i.y,s.offset.y)),i}(n,i.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:Ls(e.x,t.x),y:Ls(e.y,t.y)}}(i.layout.layoutBox,s);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(r));this.hasMutatedConstraints=!!e,e&&(r=Ns(e))}return r}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{},l=js((o=>{if(!ir(o,t,this.currentDirection))return;let l=a&&a[o]||{};r&&(l={min:0,max:0});const c=i?200:1e6,u=i?40:1e7,d={type:"inertia",velocity:n?e[o]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(o,d)}));return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return n.start(Wi(e,n,0,t,this.visualElement,!1,ts(this.visualElement,e)))}stopAnimation(){js((e=>this.getAxisMotionValue(e).stop()))}pauseAnimation(){js((e=>{var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.pause()}))}getAnimationState(e){var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){js((t=>{const{drag:n}=this.getProps();if(!ir(t,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(t);if(i&&i.layout){const{min:n,max:r}=i.layout.layoutBox[t];s.set(e[t]-yi(n,r,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!g(t)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};js((e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();i[e]=function(e,t){let n=.5;const i=Ps(e),s=Ps(t);return s>i?n=vi(t.min,t.max-i,e.min):i>s&&(n=vi(e.min,e.max-s,t.min)),G(0,1,n)}({min:n,max:n},this.constraints[e])}}));const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),js((t=>{if(!ir(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];n.set(yi(s,r,i[t]))}))}addListeners(){if(!this.visualElement.current)return;tr.set(this.visualElement,this);const e=ut(this.visualElement.current,"pointerdown",(e=>{const{drag:t,dragListener:n=!0}=this.getProps();t&&n&&this.start(e)})),t=()=>{const{dragConstraints:e}=this.getProps();g(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,i=n.addEventListener("measure",t);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),et.read(t);const s=ot(window,"resize",(()=>this.scalePositionWithinConstraints())),r=n.addEventListener("didUpdate",(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(js((t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))})),this.visualElement.render())}));return()=>{s(),e(),i(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:r=Ms,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:r,dragMomentum:o}}}function ir(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const sr=e=>(t,n)=>{e&&et.postRender((()=>e(t,n)))},rr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function or(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ar={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!se.test(e))return e;e=parseFloat(e)}return`${or(e,t.target.x)}% ${or(e,t.target.y)}%`}},lr={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,s=kn.parse(e);if(s.length>5)return i;const r=kn.createTransformer(e),o="number"!=typeof s[0]?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const c=yi(a,l,.5);return"number"==typeof s[2+o]&&(s[2+o]/=c),"number"==typeof s[3+o]&&(s[3+o]/=c),r(s)}};class cr extends s.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;var r;r=dr,Object.assign(F,r),s&&(t.group&&t.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",(()=>{this.safeToRemove()})),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),rr.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:i,isPresent:s}=this.props,r=n.projection;return r?(r.isPresent=s,i||e.layoutDependency!==t||void 0===t?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||et.postRender((()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),p.postRender((()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function ur(e){const[t,n]=function(){const e=(0,s.useContext)(a.O);if(null===e)return[!0,null];const{isPresent:t,onExitComplete:n,register:i}=e,r=(0,s.useId)();(0,s.useEffect)((()=>i(r)),[]);const o=(0,s.useCallback)((()=>n&&n(r)),[r,n]);return!t&&n?[!1,o]:[!0]}(),r=(0,s.useContext)(R.p);return(0,i.jsx)(cr,{...e,layoutGroup:r,switchLayoutGroup:(0,s.useContext)(v),isPresent:t,safeToRemove:n})}const dr={borderRadius:{...ar,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ar,borderTopRightRadius:ar,borderBottomLeftRadius:ar,borderBottomRightRadius:ar,boxShadow:lr},hr=["TopLeft","TopRight","BottomLeft","BottomRight"],mr=hr.length,pr=e=>"string"==typeof e?parseFloat(e):e,fr=e=>"number"==typeof e||se.test(e);function gr(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const vr=xr(0,.5,ui),yr=xr(.5,.95,Qe.Z);function xr(e,t,n){return i=>it?1:n(vi(e,t,i))}function wr(e,t){e.min=t.min,e.max=t.max}function br(e,t){wr(e.x,t.x),wr(e.y,t.y)}function Er(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Sr(e,t,n,i,s){return e=zs(e-=t,1/n,i),void 0!==s&&(e=zs(e,1/s,i)),e}function Pr(e,t,[n,i,s],r,o){!function(e,t=0,n=1,i=.5,s,r=e,o=e){if(ie.test(t)&&(t=parseFloat(t),t=yi(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let a=yi(r.min,r.max,i);e===r&&(a-=t),e.min=Sr(e.min,t,n,a,s),e.max=Sr(e.max,t,n,a,s)}(e,t[n],t[i],t[s],t.scale,r,o)}const Tr=["x","scaleX","originX"],Cr=["y","scaleY","originY"];function _r(e,t,n,i){Pr(e.x,t,Tr,n?n.x:void 0,i?i.x:void 0),Pr(e.y,t,Cr,n?n.y:void 0,i?i.y:void 0)}function kr(e){return 0===e.translate&&1===e.scale}function Ar(e){return kr(e.x)&&kr(e.y)}function Vr(e,t){return e.min===t.min&&e.max===t.max}function Lr(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Mr(e,t){return Lr(e.x,t.x)&&Lr(e.y,t.y)}function Rr(e){return Ps(e.x)/Ps(e.y)}function Dr(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class Ir{constructor(){this.members=[]}add(e){We(this.members,e),e.scheduleRender()}remove(e){if(Ke(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex((t=>e===t));if(0===t)return!1;let n;for(let e=t;e>=0;e--){const t=this.members[e];if(!1!==t.isPresent){n=t;break}}return!!n&&(this.promote(n),!0)}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;!1===i&&n.hide()}}exitAnimationComplete(){this.members.forEach((e=>{const{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((e=>{e.instance&&e.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Br=(e,t)=>e.depth-t.depth;class jr{constructor(){this.children=[],this.isDirty=!1}add(e){We(this.children,e),this.isDirty=!0}remove(e){Ke(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Br),this.isDirty=!1,this.children.forEach(e)}}const Nr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Or="undefined"!=typeof window&&void 0!==window.MotionDebug,Fr=["","X","Y","Z"],Hr={visibility:"hidden"};let Zr=0;function Ur(e,t,n,i){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),i&&(i[e]=0))}function zr(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return!1;const{visualElement:t}=e.options;return!!t&&(!!Qi(t)||!(!e.parent||e.parent.hasCheckedOptimisedAppear)&&zr(e.parent))}function $r({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=Zr++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Or&&(Nr.totalNodes=Nr.resolvedTargetDeltas=Nr.recalculatedProjection=0),this.nodes.forEach(Kr),this.nodes.forEach(to),this.nodes.forEach(no),this.nodes.forEach(qr),Or&&window.MotionDebug.record(Nr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;e(t,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){const n=Ht.now(),i=({timestamp:t})=>{const s=t-n;s>=250&&(tt(i),e(s-250))};return et.read(i,!0),()=>tt(i)}(i),rr.hasAnimatedSinceResize&&(rr.hasAnimatedSinceResize=!1,this.nodes.forEach(eo))}))}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&o&&(s||r)&&this.addEventListener("didUpdate",(({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:i})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const s=this.options.transition||o.getDefaultTransition()||lo,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!Mr(this.targetLayout,i)||n,c=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,c);const t={...Bt(s,"layout"),onPlay:r,onComplete:a};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||eo(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=i}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,tt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(io),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.HandoffCancelAllAnimations&&zr(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;eKs&&(t.x=1),t.yKs&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=Bs());const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(Er(this.prevProjectionDelta.x,this.projectionDelta.x),Er(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Cs(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===a&&Dr(this.projectionDelta.x,this.prevProjectionDelta.x)&&Dr(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),Or&&Nr.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null===(t=this.options.visualElement)||void 0===t||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Is(),this.projectionDelta=Is(),this.projectionDeltaWithTransform=Is()}setAnimationOrigin(e,t=!1){const n=this.snapshot,i=n?n.latestValues:{},s={...this.latestValues},r=Is();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const o=Bs(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(a&&!c&&!0===this.options.crossfade&&!this.path.some(ao));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,h,m,p,f,g;ro(r.x,e.x,n),ro(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(As(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,f=o,g=n,oo(m.x,p.x,f.x,g),oo(m.y,p.y,f.y,g),d&&(l=this.relativeTarget,h=d,Vr(l.x,h.x)&&Vr(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d=Bs()),br(d,this.relativeTarget)),a&&(this.animationValues=s,function(e,t,n,i,s,r){s?(e.opacity=yi(0,void 0!==n.opacity?n.opacity:1,vr(i)),e.opacityExit=yi(void 0!==t.opacity?t.opacity:1,0,yr(i))):r&&(e.opacity=yi(void 0!==t.opacity?t.opacity:1,void 0!==n.opacity?n.opacity:1,i));for(let s=0;s{rr.hasAnimatedSinceResize=!0,this.currentAnimation=function(e,t,n){const i=z(0)?0:Xi(0);return i.start(Wi("",i,1e3,n)),i.animation}(0,0,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:i,latestValues:s}=e;if(t&&n&&i){if(this!==e&&this.layout&&i&&mo(this.options.animationType,this.layout.layoutBox,i.layoutBox)){n=this.target||Bs();const t=Ps(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const i=Ps(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+i}br(t,n),Js(t,s),Cs(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Ir),this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const i=this.getStack();i&&i.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const i={};n.z&&Ur("z",e,i,this.animationValues);for(let t=0;t{var t;return null===(t=e.currentAnimation)||void 0===t?void 0:t.stop()})),this.root.nodes.forEach(Xr),this.root.sharedNodes.clear()}}}function Gr(e){e.updateLayout()}function Wr(e){var t;const n=(null===(t=e.resumeFrom)||void 0===t?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:i}=e.layout,{animationType:s}=e.options,r=n.source!==e.layout.source;"size"===s?js((e=>{const i=r?n.measuredBox[e]:n.layoutBox[e],s=Ps(i);i.min=t[e].min,i.max=i.min+s})):mo(s,n.layoutBox,t)&&js((i=>{const s=r?n.measuredBox[i]:n.layoutBox[i],o=Ps(t[i]);s.max=s.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+o)}));const o=Is();Cs(o,t,n.layoutBox);const a=Is();r?Cs(a,e.applyTransform(i,!0),n.measuredBox):Cs(a,t,n.layoutBox);const l=!Ar(o);let c=!1;if(!e.resumeFrom){const i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){const{snapshot:s,layout:r}=i;if(s&&r){const o=Bs();As(o,n.layoutBox,s.layoutBox);const a=Bs();As(a,t,r.layoutBox),Mr(o,a)||(c=!0),i.options.layoutRoot&&(e.relativeTarget=a,e.relativeTargetOrigin=o,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Kr(e){Or&&Nr.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function qr(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Yr(e){e.clearSnapshot()}function Xr(e){e.clearMeasurements()}function Jr(e){e.isLayoutDirty=!1}function Qr(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function eo(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function to(e){e.resolveTargetDelta()}function no(e){e.calcProjection()}function io(e){e.resetSkewAndRotation()}function so(e){e.removeLeadSnapshot()}function ro(e,t,n){e.translate=yi(t.translate,0,n),e.scale=yi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function oo(e,t,n,i){e.min=yi(t.min,n.min,i),e.max=yi(t.max,n.max,i)}function ao(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const lo={duration:.45,ease:[.4,0,.1,1]},co=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),uo=co("applewebkit/")&&!co("chrome/")?Math.round:Qe.Z;function ho(e){e.min=uo(e.min),e.max=uo(e.max)}function mo(e,t,n){return"position"===e||"preserve-aspect"===e&&(i=Rr(t),s=Rr(n),.2,!(Math.abs(i-s)<=.2));var i,s}function po(e){var t;return e!==e.root&&(null===(t=e.scroll)||void 0===t?void 0:t.wasRoot)}const fo=$r({attachResizeListener:(e,t)=>ot(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),go={current:void 0},vo=$r({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!go.current){const e=new fo({});e.mount(window),e.setOptions({layoutScroll:!0}),go.current=e}return go.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),yo={pan:{Feature:class extends yt{constructor(){super(...arguments),this.removePointerDownListener=Qe.Z}onPointerDown(e){this.session=new ms(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:er(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:sr(e),onStart:sr(t),onMove:n,onEnd:(e,t)=>{delete this.session,i&&et.postRender((()=>i(e,t)))}}}mount(){this.removePointerDownListener=ut(this.node.current,"pointerdown",(e=>this.onPointerDown(e)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends yt{constructor(e){super(e),this.removeGroupControls=Qe.Z,this.removeListeners=Qe.Z,this.controls=new nr(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Qe.Z}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:vo,MeasureLayout:ur}},xo={current:null},wo={current:!1},bo=new WeakMap,Eo=[...tn,gn,kn],So=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Po=C.length;class To{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:r},o={}){this.applyWillChange=!1,this.resolveKeyframes=(e,t,n,i)=>new this.KeyframeResolver(e,t,n,i,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=cn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,et.render(this.render,!1,!0))};const{latestValues:a,renderState:l}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.blockInitialAnimation=Boolean(s),this.isControllingVariants=_(t),this.isVariantNode=k(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:c,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==a[e]&&z(t)&&t.set(a[e],!1)}}mount(e){this.current=e,bo.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((e,t)=>this.bindToMotionValue(t,e))),wo.current||function(){if(wo.current=!0,M.j)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>xo.current=e.matches;e.addListener(t),t()}else xo.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||xo.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){bo.delete(this.current),this.projection&&this.projection.unmount(),tt(this.notifyUpdate),tt(this.render),this.valueSubscriptions.forEach((e=>e())),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){const n=Z.has(e),i=t.on("change",(t=>{this.latestValues[e]=t,this.props.onUpdate&&et.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),s=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,(()=>{i(),s(),t.owner&&t.stop()}))}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in L){const t=L[e];if(!t)continue;const{isEnabled:n,Feature:i}=t;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Bs()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;tt.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Xi(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){var n;let i=void 0===this.latestValues[e]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,e))&&void 0!==n?n:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var s;return null!=i&&("string"==typeof i&&(zt(i)||Zt(i))?i=parseFloat(i):(s=i,!Eo.find(en(s))&&kn.test(t)&&(i=In(e,t))),this.setBaseTarget(e,z(i)?i.get():i)),z(i)?i.get():i}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props;let i;if("string"==typeof n||"object"==typeof n){const s=Oe(this.props,n,null===(t=this.presenceContext)||void 0===t?void 0:t.custom);s&&(i=s[e])}if(n&&void 0!==i)return i;const s=this.getBaseTargetFromProps(this.props,e);return void 0===s||z(s)?void 0!==this.initialValues[e]&&void 0===i?void 0:this.baseTarget[e]:s}on(e,t){return this.events[e]||(this.events[e]=new Ki),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class Co extends To{constructor(){super(...arguments),this.KeyframeResolver=jn}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}}class _o extends Co{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Re}readValueFromInstance(e,t){if(Z.has(t)){const e=Dn(t);return e&&e.default||0}{const i=(n=e,window.getComputedStyle(n)),s=(me(t)?i.getPropertyValue(t):i[t])||0;return"string"==typeof s?s.trim():s}var n}measureInstanceViewportBox(e,{transformPagePoint:t}){return Qs(e,t)}build(e,t,n){ve(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Be(e,t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;z(e)&&(this.childSubscription=e.on("change",(e=>{this.current&&(this.current.textContent=`${e}`)})))}}class ko extends Co{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Bs}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Z.has(t)){const e=Dn(t);return e&&e.default||0}return t=De.has(t)?t:u(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return je(e,t,n)}build(e,t,n){ke(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,i){Ie(e,t,0,i)}mount(e){this.isSVGTag=Ve(e.tagName),super.mount(e)}}const Ao=(e,t)=>O(e)?new ko(t):new _o(t,{allowProjection:e!==s.Fragment}),Vo={...ds,..._t,...yo,layout:{ProjectionNode:vo,MeasureLayout:ur}},Lo=j(((e,t)=>function(e,{forwardMotionProps:t=!1},n,i){return{...O(e)?st:rt,preloadedFeatures:n,useRender:Me(t),createVisualElement:i,Component:e}}(e,t,Vo,Ao)))},5487:(e,t,n)=>{"use strict";n.d(t,{K:()=>s,k:()=>r});var i=n(1662);let s=i.Z,r=i.Z},1741:(e,t,n)=>{"use strict";n.d(t,{j:()=>i});const i="undefined"!=typeof window},1662:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const i=e=>e},6681:(e,t,n)=>{"use strict";n.d(t,{h:()=>s});var i=n(9196);function s(e){const t=(0,i.useRef)(null);return null===t.current&&(t.current=e()),t.current}},8868:(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var i=n(9196);const s=n(1741).j?i.useLayoutEffect:i.useEffect},46:(e,t,n)=>{"use strict";n.d(t,{$l:()=>o,BN:()=>j,DY:()=>p,Fs:()=>F,J$:()=>$,JN:()=>w,LI:()=>A,PM:()=>c,UG:()=>G,W6:()=>_,i_:()=>r,kY:()=>Y,ko:()=>Q,kw:()=>k,mf:()=>l,o8:()=>a,qC:()=>M,s6:()=>J,sj:()=>B,u3:()=>D,u_:()=>Z,w6:()=>C,xD:()=>ee});var i=n(9196);const s=()=>{},r=s(),o=Object,a=e=>e===r,l=e=>"function"==typeof e,c=(e,t)=>({...e,...t}),u=e=>l(e.then),d=new WeakMap;let h=0;const m=e=>{const t=typeof e,n=e&&e.constructor,i=n==Date;let s,r;if(o(e)!==e||i||n==RegExp)s=i?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(s=d.get(e),s)return s;if(s=++h+"~",d.set(e,s),n==Array){for(s="@",r=0;r{const n=p.get(e);return[()=>!a(t)&&e.get(t)||f,i=>{if(!a(t)){const s=e.get(t);t in g||(g[t]=s),n[5](t,c(s,i),s||f)}},n[6],()=>!a(t)&&t in g?g[t]:!a(t)&&e.get(t)||f]};let b=!0;const[E,S]=y&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[s,s],P={isOnline:()=>b,isVisible:()=>{const e=x&&document.visibilityState;return a(e)||"hidden"!==e}},T={initFocus:e=>(x&&document.addEventListener("visibilitychange",e),E("focus",e),()=>{x&&document.removeEventListener("visibilitychange",e),S("focus",e)}),initReconnect:e=>{const t=()=>{b=!0,e()},n=()=>{b=!1};return E("online",t),E("offline",n),()=>{S("online",t),S("offline",n)}}},C=!i.useId,_=!y||"Deno"in window,k=e=>y&&typeof window.requestAnimationFrame!=v?window.requestAnimationFrame(e):setTimeout(e,1),A=_?i.useEffect:i.useLayoutEffect,V="undefined"!=typeof navigator&&navigator.connection,L=!_&&V&&(["slow-2g","2g"].includes(V.effectiveType)||V.saveData),M=e=>{if(l(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?m(e):"",t]};let R=0;const D=()=>++R,I=2;var B={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:I,RECONNECT_EVENT:1};async function j(...e){const[t,n,i,s]=e,o=c({populateCache:!0,throwOnError:!0},"boolean"==typeof s?{revalidate:s}:s||{});let d=o.populateCache;const h=o.rollbackOnError;let m=o.optimisticData;const f=o.throwOnError;if(l(n)){const e=n,i=[],s=t.keys();for(const n of s)!/^\$(inf|sub)\$/.test(n)&&e(t.get(n)._k)&&i.push(n);return Promise.all(i.map(g))}return g(n);async function g(n){const[s]=M(n);if(!s)return;const[c,g]=w(t,s),[v,y,x,b]=p.get(t),E=()=>{const e=v[s];return(l(o.revalidate)?o.revalidate(c().data,n):!1!==o.revalidate)&&(delete x[s],delete b[s],e&&e[0])?e[0](I).then((()=>c().data)):c().data};if(e.length<3)return E();let S,P=i;const T=D();y[s]=[T,0];const C=!a(m),_=c(),k=_.data,A=_._c,V=a(A)?k:A;if(C&&(m=l(m)?m(V,k):m,g({data:m,_c:V})),l(P))try{P=P(V)}catch(e){S=e}if(P&&u(P)){if(P=await P.catch((e=>{S=e})),T!==y[s][0]){if(S)throw S;return P}S&&C&&(e=>"function"==typeof h?h(e):!1!==h)(S)&&(d=!0,g({data:V,_c:r}))}if(d&&!S)if(l(d)){const e=d(P,V);g({data:e,error:r,_c:r})}else g({data:P,error:r,_c:r});if(y[s][1]=D(),Promise.resolve(E()).then((()=>{g({_c:r})})),!S)return P;if(f)throw S}}const N=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},O=(e,t)=>{if(!p.has(e)){const n=c(T,t),i={},o=j.bind(r,e);let a=s;const l={},u=(e,t)=>{const n=l[e]||[];return l[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},d=(t,n,i)=>{e.set(t,n);const s=l[t];if(s)for(const e of s)e(n,i)},h=()=>{if(!p.has(e)&&(p.set(e,[i,{},{},{},o,d,u]),!_)){const t=n.initFocus(setTimeout.bind(r,N.bind(r,i,0))),s=n.initReconnect(setTimeout.bind(r,N.bind(r,i,1)));a=()=>{t&&t(),s&&s(),p.delete(e)}}};return h(),[e,o,h,a]}return[e,p.get(e)[4]]},[F,H]=O(new Map),Z=c({onLoadingSlow:s,onSuccess:s,onError:s,onErrorRetry:(e,__,t,n,i)=>{const s=t.errorRetryCount,r=i.retryCount,o=~~((Math.random()+.5)*(1<<(r<8?r:8)))*t.errorRetryInterval;!a(s)&&r>s||setTimeout(n,o,i)},onDiscarded:s,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:L?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:L?5e3:3e3,compare:(e,t)=>m(e)==m(t),isPaused:()=>!1,cache:F,mutate:H,fallback:{}},P),U=(e,t)=>{const n=c(e,t);if(t){const{use:i,fallback:s}=e,{use:r,fallback:o}=t;i&&r&&(n.use=i.concat(r)),s&&o&&(n.fallback=c(s,o))}return n},z=(0,i.createContext)({}),$=e=>{const{value:t}=e,n=(0,i.useContext)(z),s=l(t),o=(0,i.useMemo)((()=>s?t(n):t),[s,n,t]),a=(0,i.useMemo)((()=>s?o:U(n,o)),[s,n,o]),u=o&&o.provider,d=(0,i.useRef)(r);u&&!d.current&&(d.current=O(u(a.cache||F),o));const h=d.current;return h&&(a.cache=h[0],a.mutate=h[1]),A((()=>{if(h)return h[2]&&h[2](),h[3]}),[]),(0,i.createElement)(z.Provider,c(e,{value:a}))},G="$inf$",W=y&&window.__SWR_DEVTOOLS_USE__,K=W?window.__SWR_DEVTOOLS_USE__:[],q=e=>l(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],Y=()=>c(Z,(0,i.useContext)(z)),X=K.concat((e=>(t,n,i)=>e(t,n&&((...e)=>{const[i]=M(t),[,,,s]=p.get(F);if(i.startsWith(G))return n(...e);const r=s[i];return a(r)?n(...e):(delete s[i],r)}),i))),J=e=>function(...t){const n=Y(),[i,s,r]=q(t),o=U(n,r);let a=e;const{use:l}=o,c=(l||[]).concat(X);for(let e=c.length;e--;)a=c[e](a);return a(i,s||o.fetcher||null,o)},Q=(e,t,n)=>{const i=t[e]||(t[e]=[]);return i.push(n),()=>{const e=i.indexOf(n);e>=0&&(i[e]=i[i.length-1],i.pop())}},ee=(e,t)=>(...n)=>{const[i,s,r]=q(n),o=(r.use||[]).concat(t);return e(i,s,{...r,use:o})};W&&(window.__SWR_DEVTOOLS_REACT__=i)},9870:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var i=n(9196),s=n(1688),r=n(46);const o=i.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),a={dedupe:!0};r.$l.defineProperty(r.J$,"defaultValue",{value:r.u_});const l=(0,r.s6)(((e,t,n)=>{const{cache:l,compare:c,suspense:u,fallbackData:d,revalidateOnMount:h,revalidateIfStale:m,refreshInterval:p,refreshWhenHidden:f,refreshWhenOffline:g,keepPreviousData:v}=n,[y,x,w,b]=r.DY.get(l),[E,S]=(0,r.qC)(e),P=(0,i.useRef)(!1),T=(0,i.useRef)(!1),C=(0,i.useRef)(E),_=(0,i.useRef)(t),k=(0,i.useRef)(n),A=()=>k.current,V=()=>A().isVisible()&&A().isOnline(),[L,M,R,D]=(0,r.JN)(l,E),I=(0,i.useRef)({}).current,B=(0,r.o8)(d)?n.fallback[E]:d,j=(e,t)=>{for(const n in I){const i=n;if("data"===i){if(!c(e[i],t[i])){if(!(0,r.o8)(e[i]))return!1;if(!c(G,t[i]))return!1}}else if(t[i]!==e[i])return!1}return!0},N=(0,i.useMemo)((()=>{const e=!!E&&!!t&&((0,r.o8)(h)?!A().isPaused()&&!u&&(!!(0,r.o8)(m)||m):h),n=t=>{const n=(0,r.PM)(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},i=L(),s=D(),o=n(i),a=i===s?o:n(s);let l=o;return[()=>{const e=n(L());return j(e,l)?(l.data=e.data,l.isLoading=e.isLoading,l.isValidating=e.isValidating,l.error=e.error,l):(l=e,e)},()=>a]}),[l,E]),O=(0,s.useSyncExternalStore)((0,i.useCallback)((e=>R(E,((t,n)=>{j(n,t)||e()}))),[l,E]),N[0],N[1]),F=!P.current,H=y[E]&&y[E].length>0,Z=O.data,U=(0,r.o8)(Z)?B:Z,z=O.error,$=(0,i.useRef)(U),G=v?(0,r.o8)(Z)?$.current:Z:U,W=!(H&&!(0,r.o8)(z))&&(F&&!(0,r.o8)(h)?h:!A().isPaused()&&(u?!(0,r.o8)(U)&&m:(0,r.o8)(U)||m)),K=!!(E&&t&&F&&W),q=(0,r.o8)(O.isValidating)?K:O.isValidating,Y=(0,r.o8)(O.isLoading)?K:O.isLoading,X=(0,i.useCallback)((async e=>{const t=_.current;if(!E||!t||T.current||A().isPaused())return!1;let i,s,o=!0;const a=e||{},l=!w[E]||!a.dedupe,u=()=>r.w6?!T.current&&E===C.current&&P.current:E===C.current,d={isValidating:!1,isLoading:!1},h=()=>{M(d)},m=()=>{const e=w[E];e&&e[1]===s&&delete w[E]},p={isValidating:!0};(0,r.o8)(L().data)&&(p.isLoading=!0);try{if(l&&(M(p),n.loadingTimeout&&(0,r.o8)(L().data)&&setTimeout((()=>{o&&u()&&A().onLoadingSlow(E,n)}),n.loadingTimeout),w[E]=[t(S),(0,r.u3)()]),[i,s]=w[E],i=await i,l&&setTimeout(m,n.dedupingInterval),!w[E]||w[E][1]!==s)return l&&u()&&A().onDiscarded(E),!1;d.error=r.i_;const e=x[E];if(!(0,r.o8)(e)&&(s<=e[0]||s<=e[1]||0===e[1]))return h(),l&&u()&&A().onDiscarded(E),!1;const a=L().data;d.data=c(a,i)?a:i,l&&u()&&A().onSuccess(i,E,n)}catch(e){m();const t=A(),{shouldRetryOnError:n}=t;t.isPaused()||(d.error=e,l&&u()&&(t.onError(e,E,t),(!0===n||(0,r.mf)(n)&&n(e))&&(A().revalidateOnFocus&&A().revalidateOnReconnect&&!V()||t.onErrorRetry(e,E,t,(e=>{const t=y[E];t&&t[0]&&t[0](r.sj.ERROR_REVALIDATE_EVENT,e)}),{retryCount:(a.retryCount||0)+1,dedupe:!0}))))}return o=!1,h(),!0}),[E,l]),J=(0,i.useCallback)(((...e)=>(0,r.BN)(l,C.current,...e)),[]);if((0,r.LI)((()=>{_.current=t,k.current=n,(0,r.o8)(Z)||($.current=Z)})),(0,r.LI)((()=>{if(!E)return;const e=X.bind(r.i_,a);let t=0;const n=(0,r.ko)(E,y,((n,i={})=>{if(n==r.sj.FOCUS_EVENT){const n=Date.now();A().revalidateOnFocus&&n>t&&V()&&(t=n+A().focusThrottleInterval,e())}else if(n==r.sj.RECONNECT_EVENT)A().revalidateOnReconnect&&V()&&e();else{if(n==r.sj.MUTATE_EVENT)return X();if(n==r.sj.ERROR_REVALIDATE_EVENT)return X(i)}}));return T.current=!1,C.current=E,P.current=!0,M({_k:S}),W&&((0,r.o8)(U)||r.W6?e():(0,r.kw)(e)),()=>{T.current=!0,n()}}),[E]),(0,r.LI)((()=>{let e;function t(){const t=(0,r.mf)(p)?p(L().data):p;t&&-1!==e&&(e=setTimeout(n,t))}function n(){L().error||!f&&!A().isVisible()||!g&&!A().isOnline()?t():X(a).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[p,f,g,E]),(0,i.useDebugValue)(G),u&&(0,r.o8)(U)&&E){if(!r.w6&&r.W6)throw new Error("Fallback data is required when using suspense in SSR.");_.current=t,k.current=n,T.current=!1;const e=b[E];if(!(0,r.o8)(e)){const t=J(e);o(t)}if(!(0,r.o8)(z))throw z;{const e=X(a);(0,r.o8)(G)||(e.status="fulfilled",e.value=!0),o(e)}}return{mutate:J,get data(){return I.data=!0,G},get error(){return I.error=!0,z},get isValidating(){return I.isValidating=!0,q},get isLoading(){return I.isLoading=!0,Y}}})),c=(0,r.xD)(l,(e=>(t,n,i)=>(i.revalidateOnFocus=!1,i.revalidateIfStale=!1,i.revalidateOnReconnect=!1,e(t,n,i))))},270:(e,t,n)=>{"use strict";n.d(t,{Ue:()=>d});const i=e=>{let t;const n=new Set,i=(e,i)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=i?i:"object"!=typeof s||null===s)?s:Object.assign({},t,s),n.forEach((n=>n(t,e)))}},s=()=>t,r={setState:i,getState:s,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},o=t=e(i,s,r);return r};var s=n(9196),r=n(2798);const{useDebugValue:o}=s,{useSyncExternalStoreWithSelector:a}=r;let l=!1;const c=e=>e,u=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?i(e):i)(e):e,n=(e,n)=>function(e,t=c,n){n&&!l&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),l=!0);const i=a(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return o(i),i}(t,e,n);return Object.assign(n,t),n},d=e=>e?u(e):u},782:(e,t,n)=>{"use strict";n.d(t,{FL:()=>a,mW:()=>r,tJ:()=>c});const i=new Map,s=e=>{const t=i.get(e);return t?Object.fromEntries(Object.entries(t.stores).map((([e,t])=>[e,t.getState()]))):{}},r=(e,t={})=>(n,r,a)=>{const{enabled:l,anonymousActionType:c,store:u,...d}=t;let h;try{h=(null==l||l)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!h)return l&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(n,r,a);const{connection:m,...p}=((e,t,n)=>{if(void 0===e)return{type:"untracked",connection:t.connect(n)};const s=i.get(n.name);if(s)return{type:"tracked",store:e,...s};const r={connection:t.connect(n),stores:{}};return i.set(n.name,r),{type:"tracked",store:e,...r}})(u,h,d);let f=!0;a.setState=(e,t,i)=>{const o=n(e,t);if(!f)return o;const l=void 0===i?{type:c||"anonymous"}:"string"==typeof i?{type:i}:i;return void 0===u?(null==m||m.send(l,r()),o):(null==m||m.send({...l,type:`${u}/${l.type}`},{...s(d.name),[u]:a.getState()}),o)};const g=(...e)=>{const t=f;f=!1,n(...e),f=t},v=e(a.setState,r,a);if("untracked"===p.type?null==m||m.init(v):(p.stores[p.store]=a,null==m||m.init(Object.fromEntries(Object.entries(p.stores).map((([e,t])=>[e,e===p.store?v:t.getState()]))))),a.dispatchFromDevtools&&"function"==typeof a.dispatch){let e=!1;const t=a.dispatch;a.dispatch=(...n)=>{"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return m.subscribe((e=>{var t;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):o(e.payload,(e=>{if("__setState"!==e.type)a.dispatchFromDevtools&&"function"==typeof a.dispatch&&a.dispatch(e);else{if(void 0===u)return void g(e.state);1!==Object.keys(e.state).length&&console.error('\n [zustand devtools middleware] Unsupported __setState action format. \n When using \'store\' option in devtools(), the \'state\' should have only one key, which is a value of \'store\' that was passed in devtools(),\n and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }\n ');const t=e.state[u];if(null==t)return;JSON.stringify(a.getState())!==JSON.stringify(t)&&g(t)}}));case"DISPATCH":switch(e.payload.type){case"RESET":return g(v),void 0===u?null==m?void 0:m.init(a.getState()):null==m?void 0:m.init(s(d.name));case"COMMIT":return void 0===u?void(null==m||m.init(a.getState())):null==m?void 0:m.init(s(d.name));case"ROLLBACK":return o(e.state,(e=>{if(void 0===u)return g(e),void(null==m||m.init(a.getState()));g(e[u]),null==m||m.init(s(d.name))}));case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return o(e.state,(e=>{void 0!==u?JSON.stringify(a.getState())!==JSON.stringify(e[u])&&g(e[u]):g(e)}));case"IMPORT_STATE":{const{nextLiftedState:n}=e.payload,i=null==(t=n.computedStates.slice(-1)[0])?void 0:t.state;if(!i)return;return g(void 0===u?i:i[u]),void(null==m||m.send(null,n))}case"PAUSE_RECORDING":return f=!f}return}})),v},o=(e,t)=>{let n;try{n=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==n&&t(n)};function a(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var i;const s=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),r=null!=(i=n.getItem(e))?i:null;return r instanceof Promise?r.then(s):s(r)},setItem:(e,i)=>n.setItem(e,JSON.stringify(i,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const l=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>l(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>l(t)(e)}}},c=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?(console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),((e,t)=>(n,i,s)=>{let r={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1;const a=new Set,c=new Set;let u;try{u=r.getStorage()}catch(e){}if(!u)return e(((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...e)}),i,s);const d=l(r.serialize),h=()=>{const e=r.partialize({...i()});let t;const n=d({state:e,version:r.version}).then((e=>u.setItem(r.name,e))).catch((e=>{t=e}));if(t)throw t;return n},m=s.setState;s.setState=(e,t)=>{m(e,t),h()};const p=e(((...e)=>{n(...e),h()}),i,s);let f;const g=()=>{var e;if(!u)return;o=!1,a.forEach((e=>e(i())));const t=(null==(e=r.onRehydrateStorage)?void 0:e.call(r,i()))||void 0;return l(u.getItem.bind(u))(r.name).then((e=>{if(e)return r.deserialize(e)})).then((e=>{if(e){if("number"!=typeof e.version||e.version===r.version)return e.state;if(r.migrate)return r.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}})).then((e=>{var t;return f=r.merge(e,null!=(t=i())?t:p),n(f,!0),h()})).then((()=>{null==t||t(f,void 0),o=!0,c.forEach((e=>e(f)))})).catch((e=>{null==t||t(void 0,e)}))};return s.persist={setOptions:e=>{r={...r,...e},e.getStorage&&(u=e.getStorage())},clearStorage:()=>{null==u||u.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:e=>(a.add(e),()=>{a.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},g(),f||p})(e,t)):((e,t)=>(n,i,s)=>{let r={storage:a((()=>localStorage)),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1;const c=new Set,u=new Set;let d=r.storage;if(!d)return e(((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...e)}),i,s);const h=()=>{const e=r.partialize({...i()});return d.setItem(r.name,{state:e,version:r.version})},m=s.setState;s.setState=(e,t)=>{m(e,t),h()};const p=e(((...e)=>{n(...e),h()}),i,s);let f;s.getInitialState=()=>p;const g=()=>{var e,t;if(!d)return;o=!1,c.forEach((e=>{var t;return e(null!=(t=i())?t:p)}));const s=(null==(t=r.onRehydrateStorage)?void 0:t.call(r,null!=(e=i())?e:p))||void 0;return l(d.getItem.bind(d))(r.name).then((e=>{if(e){if("number"!=typeof e.version||e.version===r.version)return[!1,e.state];if(r.migrate)return[!0,r.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]})).then((e=>{var t;const[s,o]=e;if(f=r.merge(o,null!=(t=i())?t:p),n(f,!0),s)return h()})).then((()=>{null==s||s(f,void 0),f=i(),o=!0,u.forEach((e=>e(f)))})).catch((e=>{null==s||s(void 0,e)}))};return s.persist={setOptions:e=>{r={...r,...e},e.storage&&(d=e.storage)},clearStorage:()=>{null==d||d.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},r.skipHydration||g(),f||p})(e,t)}},e=>{e(e.s=8360)}]);{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}